/* ============================================================
   store_cloth admin — application styles
   Direction: clean dashboard, no decorative flourish, generous
   whitespace, fast scannable. Light by default, respects dark.
   ============================================================ */

:root {
  /* light theme */
  --bg:           #f7f7f6;
  --surface:     #ffffff;
  --surface-2:   #fafaf9;
  --border:      #e8e6e3;
  --border-firm: #d6d3cf;
  --text:        #1a1a1a;
  --text-soft:   #5a5a58;
  --text-mute:   #8e8c89;

  --accent:      #1f787b;
  --accent-deep: #155f62;
  --accent-soft: #e8f2f2;

  --danger:      #c4362f;
  --danger-soft: #fbecea;
  --warn:        #b8731f;
  --warn-soft:   #fbf2e3;
  --ok:          #437a3f;
  --ok-soft:     #ecf3eb;

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.04);
  --shadow:      0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:   0 20px 40px -16px rgba(0,0,0,0.18);

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #131211;
    --surface:    #1c1b1a;
    --surface-2:  #232220;
    --border:     #2d2b29;
    --border-firm:#3a3835;
    --text:       #eee9e0;
    --text-soft:  #b0aba2;
    --text-mute:  #807a72;

    --accent:      #4ca8aa;
    --accent-deep: #6ec2c4;
    --accent-soft: #1c3536;

    --danger:      #e07570;
    --danger-soft: #3a201d;
    --warn:        #d99a4d;
    --warn-soft:   #392a14;
    --ok:          #7fb87b;
    --ok-soft:     #1f3220;

    --shadow:    0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg: 0 20px 40px -16px rgba(0,0,0,0.55);
  }
}

/* reset */
*,*::before,*::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body { overflow-x: hidden; }

button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent); color: white; }

/* ============================================================
   LOGIN
   ============================================================ */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 30% 20%, var(--accent-soft) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, var(--accent-soft) 0%, transparent 50%),
    var(--bg);
}
.login__card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
}
.login__brand {
  text-align: center;
  margin-bottom: 32px;
}
.login__logo {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 16px;
}
.login__brand h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.login__host {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login__msg {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
  display: none;
}
.login__msg--show { display: block; }

.login__note {
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
  margin-top: 20px;
}

/* ============================================================
   FORM FIELDS
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}
.field input,
.field select,
.field textarea {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-firm);
  border-radius: var(--r-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-firm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn--danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--block { width: 100%; padding: 12px; }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ============================================================
   APP SHELL — TOP BAR
   ============================================================ */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 60px;
  flex-shrink: 0;
  z-index: 20;
}

.topbar__menu { display: none; }

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__logo { color: var(--accent); display: inline-flex; }
.topbar__name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.topbar__tenant {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
  padding: 3px 8px;
  background: var(--surface-2);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.topbar__tenant--super {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
  color: var(--accent);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar__user {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  min-height: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}
.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar__items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
  text-align: left;
}
.sidebar__item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar__item--active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar__item--active svg { color: var(--accent); }
.sidebar__item svg { color: var(--text-mute); flex-shrink: 0; transition: color 0.15s; }
.sidebar__item:hover svg { color: var(--text); }

.sidebar__foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.sidebar__build {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-mute);
}

/* ============================================================
   MAIN VIEW
   ============================================================ */
.main {
  padding: 32px 40px;
  overflow-y: auto;
  background: var(--bg);
}

.view__head {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.view__title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}
.view__sub {
  color: var(--text-soft);
  font-size: 14px;
}

/* ============================================================
   STATS / CARDS
   ============================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
}
.stat__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.stat__value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}
.stat__hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-soft);
}

/* ============================================================
   PLACEHOLDERS (used until each section is built)
   ============================================================ */
.placeholders {
  display: grid;
  gap: 16px;
}
.placeholder {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px 28px;
}
.placeholder h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.005em;
}
.placeholder p {
  color: var(--text-soft);
  margin-bottom: 14px;
}
.placeholder ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.placeholder li {
  padding: 8px 0 8px 18px;
  position: relative;
  color: var(--text-soft);
  font-size: 13.5px;
  border-bottom: 1px dashed var(--border);
}
.placeholder li:last-child { border-bottom: 0; }
.placeholder li::before {
  content: "";
  position: absolute;
  left: 0; top: 16px;
  width: 8px; height: 1px;
  background: var(--accent);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--text);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
}
.toast--err { background: var(--danger); color: white; }
.toast--ok  { background: var(--ok); color: white; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
  .topbar__menu { display: inline-grid; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar--open { transform: translateX(0); }
  .main { padding: 24px 20px; }
  .view__title { font-size: 22px; }
  .topbar__tenant { display: none; }
}

@media (max-width: 540px) {
  .topbar { padding: 10px 14px; }
  .topbar__name { font-size: 14px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat__value { font-size: 22px; }
  .login__card { padding: 32px 24px; }
}
