:root {
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-700: #b45309;
  --amber-800: #92400e;
  --amber-900: #78350f;
  --emerald-50: #ecfdf5;
  --emerald-200: #a7f3d0;
  --emerald-700: #047857;
  --red-50: #fef2f2;
  --red-200: #fecaca;
  --red-700: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--stone-50);
  color: var(--stone-900);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--amber-800); text-decoration: none; }
a:hover { text-decoration: underline; }

.page { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem; }

.nav { border-bottom: 1px solid var(--stone-200); background: white; }
.nav-inner {
  max-width: 960px; margin: 0 auto; padding: .75rem 1.25rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
}
.brand { display: flex; align-items: baseline; gap: .5rem; }
.brand-name { font-size: 1.35rem; font-weight: 800; color: var(--amber-800); letter-spacing: -0.01em; }
.brand-sub { font-size: .75rem; color: var(--stone-500); }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-size: .9rem; }
.nav-links a, .nav-links .link-btn {
  padding: .4rem .7rem; border-radius: .4rem; color: var(--stone-700); text-decoration: none;
}
.nav-links a:hover { background: var(--amber-50); color: var(--amber-900); text-decoration: none; }
.link-btn {
  background: none; border: none; cursor: pointer; font: inherit; color: var(--stone-500);
}
.link-btn:hover { background: var(--stone-100); border-radius: .4rem; }
.inline-form { display: inline; }

h1 { font-size: 1.6rem; font-weight: 800; margin: 0 0 .25rem; }
h2.section-title {
  font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--stone-500); margin: 0 0 .75rem;
}
.subtitle { color: var(--stone-500); font-size: .9rem; margin: 0 0 1.5rem; }

.card { background: white; border: 1px solid var(--stone-200); border-radius: .75rem; padding: 1.25rem; margin-bottom: 1.5rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat { background: white; border: 1px solid var(--stone-200); border-radius: .75rem; padding: 1.1rem; }
.stat .stat-label { font-size: .85rem; color: var(--stone-500); }
.stat .stat-value { font-size: 1.8rem; font-weight: 800; color: var(--amber-800); margin: .1rem 0; }
.stat .stat-sub { font-size: .75rem; color: var(--stone-400); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
.field label { font-size: .78rem; font-weight: 600; color: var(--stone-700); }
.field input, .field select {
  border: 1px solid var(--stone-300); border-radius: .4rem; padding: .45rem .6rem; font-size: .9rem; font-family: inherit;
}
.field input:focus, .field select:focus { outline: 2px solid var(--amber-700); outline-offset: 1px; }

.actions-row { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; }

.btn {
  display: inline-block; border: none; border-radius: .4rem; padding: .55rem 1.1rem;
  font-size: .9rem; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--amber-800); color: white; }
.btn-primary:hover { background: var(--amber-900); text-decoration: none; }
.btn-secondary { background: white; border: 1px solid var(--stone-300); color: var(--stone-700); }
.btn-secondary:hover { background: var(--stone-100); text-decoration: none; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
table thead { background: var(--stone-100); color: var(--stone-500); text-align: left; }
table th, table td { padding: .55rem .85rem; }
table tbody tr { border-top: 1px solid var(--stone-100); }
.table-card { background: white; border: 1px solid var(--stone-200); border-radius: .75rem; overflow: hidden; }
.empty-state { padding: 1.5rem; text-align: center; color: var(--stone-400); }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; }
.badge-active { background: var(--emerald-50); color: var(--emerald-700); }
.badge-inactive { background: var(--stone-100); color: var(--stone-500); }

.alert { border-radius: .5rem; padding: .6rem .9rem; font-size: .85rem; margin-bottom: 1rem; }
.alert-error { background: var(--red-50); color: var(--red-700); border: 1px solid var(--red-200); }
.alert-success { background: var(--emerald-50); color: var(--emerald-700); border: 1px solid var(--emerald-200); }

.login-wrap {
  min-height: calc(100vh - 2rem); display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(to bottom, var(--amber-50), var(--stone-50));
  margin: -2rem -1.25rem; padding: 2rem 1.25rem;
}
.login-box { width: 100%; max-width: 380px; }
.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-header h1 { font-size: 2.25rem; color: var(--amber-800); }
.lang-toggle { display: flex; justify-content: flex-end; gap: .4rem; margin-bottom: .75rem; font-size: .8rem; }
.lang-toggle button {
  background: none; border: none; border-radius: .3rem; padding: .25rem .5rem; cursor: pointer; color: var(--stone-400); font: inherit;
}
.lang-toggle button.active { background: var(--amber-100); color: var(--amber-900); font-weight: 700; }

.rate-bar-wrap { display: flex; align-items: center; gap: .5rem; }
.rate-bar { width: 100px; height: .45rem; border-radius: 999px; background: var(--stone-100); overflow: hidden; }
.rate-bar-fill { height: 100%; background: var(--amber-700); }
.rate-label { font-size: .75rem; color: var(--stone-500); white-space: nowrap; }

.group-switcher { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.group-switcher label { color: var(--stone-500); }
.group-switcher select { border: 1px solid var(--stone-300); border-radius: .4rem; padding: .3rem .5rem; font: inherit; }

.hint { font-size: .78rem; color: var(--stone-400); margin-top: .3rem; }

.checkbox-row { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0; border-top: 1px solid var(--stone-100); }
.checkbox-row:first-child { border-top: none; }
.checkbox-row label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; }
