*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  color: #1a1a1a;
  background: #fafafa;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: #2563eb;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ============== Auth pages (login, change-password) ============== */

body > main {
  max-width: 480px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

main h1 {
  font-size: 1.5rem;
  margin: 0 0 1.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: #555;
}

input,
select,
textarea {
  padding: 0.6rem 0.75rem;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  font-family: inherit;
  color: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

button {
  padding: 0.55rem 0.95rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
}
button:hover {
  background: #333;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d0d0d0;
}
button.secondary:hover {
  background: #f0f0f0;
}

button.danger {
  background: #b91c1c;
}
button.danger:hover {
  background: #991b1b;
}

button.link-button {
  background: transparent;
  color: #2563eb;
  padding: 0;
  font-size: inherit;
}
button.link-button:hover {
  background: transparent;
  text-decoration: underline;
}

a.button-link-secondary {
  display: inline-block;
  padding: 0.55rem 0.95rem;
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}
a.button-link-secondary:hover {
  background: #f0f0f0;
  text-decoration: none;
}

.error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 0;
}

.warning {
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 0;
}

.info {
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin: 0;
}

/* ============== App shell ============== */

.app-shell {
  min-height: 100vh;
  background: #fafafa;
}

.nav {
  background: #1a1a1a;
  color: #fff;
  padding: 0 1.5rem;
  border-bottom: 1px solid #000;
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 52px;
}

.nav-brand {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.nav-link {
  color: #d0d0d0;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 5px;
  font-size: 0.9rem;
}
.nav-link:hover {
  color: #fff;
  background: #2a2a2a;
  text-decoration: none;
}
.nav-link-active {
  color: #fff;
  background: #2a2a2a;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: #d0d0d0;
}

.nav-signout {
  background: transparent;
  color: #d0d0d0;
  border: 1px solid #444;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}
.nav-signout:hover {
  background: #2a2a2a;
  color: #fff;
}

.app-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ============== Page header ============== */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 1.5rem;
  margin: 0;
}

.page-head .subtitle {
  color: #777;
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}

.page-head-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============== Cards / panels ============== */

.panel {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

/* ============== Tables ============== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #fff;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data th,
table.data td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}

table.data thead th {
  background: #f7f7f7;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  border-bottom: 1px solid #e5e5e5;
  white-space: nowrap;
}

table.data thead th button {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

table.data tbody tr:hover {
  background: #fafafa;
}

table.data td.num,
table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

table.data tr.row-blocked td {
  background: #fef2f2;
}
table.data tr.row-blocked:hover td {
  background: #fee2e2;
}

table.data tr.row-transferred td {
  color: #888;
}

/* ============== Status badges ============== */

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  background: #1a1a1a;
  color: #fff;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-muted {
  background: #e5e5e5;
  color: #555;
}
.badge-warn {
  background: #fde68a;
  color: #78350f;
}
.badge-danger {
  background: #fecaca;
  color: #7f1d1d;
}
.badge-ok {
  background: #bbf7d0;
  color: #14532d;
}

/* ============== Forms in tables (inline edits) ============== */

table.data input,
table.data select {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  width: 100%;
}

.row-form {
  display: contents;
}

/* ============== Toolbar ============== */

.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.toolbar label {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #555;
}
.toolbar select,
.toolbar input {
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
}

/* ============== File upload ============== */

.file-drop {
  border: 2px dashed #c0c0c0;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  background: #fff;
  color: #666;
}
.file-drop input[type='file'] {
  margin-top: 0.75rem;
}

/* ============== Empty state ============== */

.empty {
  text-align: center;
  color: #777;
  padding: 2rem;
}

/* ============== Numbers/stats ============== */

.stat-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.78rem;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-value.over-target {
  color: #15803d;
}

.stat-value.under-target {
  color: #b45309;
}

.summary-headline {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  padding: 1.75rem 1.5rem;
}

.summary-cost {
  font-size: 2.8rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.summary-hours {
  font-size: 1rem;
  color: #555;
  font-variant-numeric: tabular-nums;
}

.summary-target {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.summary-target.over-target {
  color: #15803d;
}

.summary-target.under-target {
  color: #b45309;
}

.stat-sub {
  font-size: 0.82rem;
  color: #777;
}

/* ============== Misc ============== */

.muted {
  color: #888;
}

.right {
  text-align: right;
}

.spread {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.flex-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

hr {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 1.5rem 0;
}
