/* StickHive — layout.css: shell aplikasi, halaman auth, responsif */

/* ---------- Halaman auth (login/register) ---------- */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh; /* tinggi viewport dinamis browser mobile (audit R4-F21) */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(232, 162, 58, 0.12) 0, transparent 32%),
    radial-gradient(circle at 85% 85%, rgba(75, 122, 108, 0.1) 0, transparent 34%),
    var(--parchment);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 0 L56 16 L56 48 L28 64 L0 48 L0 16 Z' fill='none' stroke='%23ded5c2' stroke-opacity='0.35'/%3E%3Cpath d='M28 50 L56 66 L56 98 L28 114 L0 98 L0 66 Z' fill='none' stroke='%23ded5c2' stroke-opacity='0.35'/%3E%3C/svg%3E");
  background-size: 56px 100px;
  opacity: 0.5;
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 34px 30px;
  border: 1px solid var(--ash);
  box-shadow: var(--shadow-hard-lg);
  position: relative;
}

.auth-card .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 6px;
}

.auth-card .logo svg {
  width: 40px;
  height: 40px;
}

.auth-card h1 {
  font-size: 1.55rem;
  text-align: center;
  font-weight: 700;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-bottom: 22px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.auth-card form {
  display: flex;
  flex-direction: column;
}

.auth-card .foot {
  margin-top: 16px;
  font-size: 0.9rem;
  text-align: center;
}

/* Footer hak cipta (bukti kepemilikan, audit deploy R4). */
.auth-footer {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.app-footer {
  margin-top: 26px;
  padding: 10px 0 4px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
}

/* ---------- Shell aplikasi ---------- */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: 62px 1fr;
  grid-template-areas:
    "header header"
    "sidebar main";
  height: 100vh;
  height: 100dvh; /* fallback-deklarasi: browser lama pakai vh (audit R4-F21) */
}

.app > * {
  min-width: 0;
}

.app-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--parchment-bright);
  border-bottom: 1px solid var(--ash);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.app-header .brand svg {
  width: 30px;
  height: 30px;
}

.app-header .spacer {
  flex: 1;
}

.quota-bar {
  display: flex;
  gap: 6px;
  align-items: center;
}

.quota-bar .chip {
  background: var(--parchment);
}

.quota-bar .chip-warn {
  background: var(--amber);
}

.app-sidebar {
  grid-area: sidebar;
  background: var(--parchment-bright);
  border-right: 1px solid var(--ash);
  overflow-y: auto;
  padding: 14px 12px 90px;
}

.app-main {
  grid-area: main;
  overflow-y: auto;
  padding: 20px;
}

.menu-toggle {
  display: none;
}

/* Tab cabang hanya relevan di ponsel; di tablet/desktop sebelumnya muncul sebagai
   tombol mati tanpa gaya (audit R4-F26). */
.branch-tabs {
  display: none;
}

/* ---------- Judul section ---------- */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 1.35rem;
  flex: 1;
}

.overdue-badge {
  background: var(--cranberry);
  color: #fff;
  border-radius: 999px;
  padding: 3px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
}

/* ---------- Panel dua cabang ---------- */
.branches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.branch {
  background: var(--surface);
  border: 1px solid var(--ash);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.branch h3 {
  padding: 13px 16px;
  font-size: 0.95rem;
  font-family: var(--font-display);
  letter-spacing: 0;
  border-bottom: 1px solid var(--ash);
  display: flex;
  align-items: center;
  gap: 8px;
}

#branch-reminder h3 {
  box-shadow: inset 3px 0 0 var(--cranberry);
  border-radius: var(--radius) var(--radius) 0 0;
}

#branch-material h3 {
  box-shadow: inset 3px 0 0 var(--sage);
  border-radius: var(--radius) var(--radius) 0 0;
}

.branch-list {
  padding: 10px;
  min-height: 120px;
}

.branch-empty {
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px 8px;
  font-family: var(--font-mono);
}

/* ---------- Drawer & breakpoint ponsel ---------- */
@media (max-width: 480px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
    grid-template-rows: 60px 1fr;
  }

  .app-header {
    gap: 6px;
    padding: 0 6px;
    overflow-x: auto;
  }

  .app-header .brand-name {
    display: none;
  }

  .app-header .brand {
    font-size: 0.95rem;
    gap: 5px;
    flex-shrink: 0;
  }

  .app-header .brand svg {
    width: 24px;
    height: 24px;
  }

  .logout-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .app-header #logout-btn {
    padding: 6px 8px;
    min-width: 0;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--ink);
    font-size: 1.4rem;
    /* target sentuh ≥ 40px (audit R4-F22) */
    min-width: 40px;
    min-height: 40px;
    padding: 6px 8px;
    flex-shrink: 0;
  }

  .app-sidebar {
    position: fixed;
    inset: 60px 0 auto 0;
    z-index: 40;
    max-height: 70vh;
    transform: translateY(-130%);
    transition: transform 0.22s ease;
    border-right: none;
    border-bottom: 1px solid var(--ash);
    border-radius: 0 0 var(--radius) var(--radius);
    padding-bottom: 16px;
  }

  .app-sidebar.open {
    transform: translateY(0);
  }

  .branches {
    grid-template-columns: 1fr;
  }

  .branch-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
  }

  .branch-tabs button {
    flex: 1;
    padding: 9px;
    border: 1px solid var(--ash-deep);
    border-radius: 10px;
    background: var(--parchment-bright);
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--ink-soft);
  }

  .branch-tabs button.active {
    background: var(--amber);
    color: var(--ink);
    border-color: var(--amber-deep);
    box-shadow: var(--shadow-hard);
  }

  .app-main {
    padding: 12px;
  }
}

@media (min-width: 481px) and (max-width: 900px) {
  .app {
    grid-template-columns: 216px 1fr;
  }
}
