.admin-body { min-height: 100vh; background: #f5f4f1; }
.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 17rem minmax(0, 1fr); }
.admin-sidebar { position: sticky; z-index: 20; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 2rem 1.5rem; background: var(--dark); color: white; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar-close { display: none; border: 0; background: none; color: white; font-size: 1.5rem; font-weight: 300; }
.admin-context { margin-top: 4.5rem; padding-bottom: 1.8rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.admin-context span, .admin-context small { display: block; color: rgba(255,255,255,.45); font-size: .6rem; letter-spacing: .11em; text-transform: uppercase; }
.admin-context strong { display: block; margin: .45rem 0 .55rem; font-size: 1.45rem; font-weight: 300; }
.admin-nav { display: grid; gap: .25rem; margin-top: 2rem; }
.admin-nav button { display: grid; grid-template-columns: 1.5rem 1fr; gap: .7rem; width: 100%; padding: .85rem .8rem; border: 0; border-radius: .35rem; background: transparent; color: rgba(255,255,255,.6); text-align: left; font-size: .76rem; letter-spacing: .05em; cursor: pointer; }
.admin-nav button span { color: rgba(255,255,255,.3); font-size: .58rem; }
.admin-nav button:hover, .admin-nav button.is-active { background: rgba(120,161,140,.12); color: white; }
.admin-nav button.is-active span { color: var(--primary); }
.sidebar-foot { display: grid; grid-template-columns: auto 1fr; gap: .75rem; margin-top: auto; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.12); }
.status-dot { width: .5rem; height: .5rem; margin-top: .35rem; border-radius: 50%; background: #d2a862; box-shadow: 0 0 0 4px rgba(210,168,98,.1); }
.sidebar-foot p { color: rgba(255,255,255,.42); font-size: .65rem; line-height: 1.55; }
.sidebar-foot strong { display: block; color: rgba(255,255,255,.72); font-weight: 400; }
.admin-content { min-width: 0; }
.admin-topbar { min-height: 5rem; display: flex; align-items: center; justify-content: flex-end; padding: 0 3rem; border-bottom: 1px solid var(--border); background: rgba(249,248,246,.82); }
.admin-topbar > div { text-align: right; }
.admin-topbar span { display: block; color: var(--muted); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }
.admin-topbar strong { display: block; margin-top: .3rem; font-size: .8rem; font-weight: 400; }
.sidebar-open { display: none; align-items: center; gap: 4px; padding: .7rem 0; border: 0; background: none; }
.sidebar-open span { width: 1rem; height: 1px; background: currentColor; }
.sidebar-open b { margin-left: .4rem; font-size: .65rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
#admin-main { padding: 4.5rem 3rem 6rem; }
.admin-view { width: min(100%, 1200px); margin-inline: auto; animation: step-in .25s ease both; }
.admin-page-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 3.5rem; }
.admin-page-heading h1 { margin-top: 1rem; font-size: clamp(2.4rem, 4.5vw, 4.4rem); font-weight: 300; letter-spacing: -.05em; line-height: 1; }
.admin-page-heading p { margin-top: 1rem; color: var(--muted); font-size: .9rem; font-weight: 300; }
.metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: rgba(255,255,255,.45); }
.metric-grid div { min-width: 0; padding: 1.5rem; border-right: 1px solid var(--border); }
.metric-grid div:last-child { border: 0; }
.metric-grid dt { min-height: 2.3em; color: var(--muted); font-size: .6rem; letter-spacing: .1em; line-height: 1.4; text-transform: uppercase; }
.metric-grid dd { margin-top: 1rem; font-size: clamp(1.4rem, 2vw, 2rem); font-weight: 300; letter-spacing: -.035em; white-space: nowrap; }
.metric-grid small { display: block; margin-top: .45rem; color: var(--muted); font-size: .63rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(17rem, .7fr); gap: 1.5rem; margin-top: 2rem; }
.admin-panel { border: 1px solid var(--border); background: white; }
.customer-overview { padding: 1.8rem; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.panel-heading h2, .allowance-note h2, .live-allowance h2 { margin-top: .65rem; font-size: 1.35rem; font-weight: 400; letter-spacing: -.025em; }
.panel-heading button { padding: .4rem 0; border: 0; border-bottom: 1px solid currentColor; background: none; color: var(--muted); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.compact-customer { display: grid; grid-template-columns: minmax(0, 1.4fr) .7fr 1fr auto; align-items: center; gap: 1.5rem; padding: 1.2rem 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.compact-customer:last-child { border: 0; }
.compact-customer:hover h3 { color: #527362; }
.compact-customer h3 { overflow: hidden; font-size: .9rem; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.compact-customer p, .compact-customer > span { color: var(--muted); font-size: .7rem; }
.allowance-bar { height: 3px; margin-top: .5rem; background: var(--secondary); }
.allowance-bar span { display: block; height: 100%; background: var(--primary); }
.compact-customer button, .customer-table button { width: 2rem; height: 2rem; border: 1px solid var(--border); border-radius: 50%; background: transparent; cursor: pointer; }
.compact-customer button:hover, .customer-table button:hover { border-color: var(--primary); background: var(--primary-soft); }
.allowance-note { padding: 1.8rem; background: var(--dark); color: white; }
.allowance-note .eyebrow { color: var(--primary); }
.allowance-note h2 { margin-top: 1.2rem; font-size: 1.65rem; font-weight: 300; line-height: 1.25; }
.allowance-note > p { margin-top: 1.2rem; color: rgba(255,255,255,.55); font-size: .78rem; font-weight: 300; line-height: 1.7; }
.allowance-example { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.14); }
.allowance-example span, .allowance-example small { display: block; color: rgba(255,255,255,.45); font-size: .6rem; letter-spacing: .09em; text-transform: uppercase; }
.allowance-example strong { display: block; margin: .65rem 0; color: #a8c7b6; font-size: 1.1rem; font-weight: 400; }
.admin-search input { width: min(20rem, 35vw); padding: .75rem 0; border: 0; border-bottom: 1px solid var(--border); outline: 0; background: transparent; font-size: .85rem; }
.admin-search input:focus { border-color: var(--primary); }
.customer-table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
.customer-table { width: 100%; border-collapse: collapse; text-align: left; }
.customer-table th { padding: 1rem .75rem; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .58rem; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; white-space: nowrap; }
.customer-table td { padding: 1.15rem .75rem; border-bottom: 1px solid var(--border); font-size: .78rem; white-space: nowrap; }
.customer-table td:first-child { min-width: 13rem; font-size: .87rem; font-weight: 400; }
.customer-table td:nth-child(n+2):not(:last-child) { color: var(--muted); }
.status-badge { display: inline-flex; align-items: center; gap: .5rem; color: #527362 !important; font-size: .63rem !important; letter-spacing: .07em; text-transform: uppercase; }
.status-badge::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--primary); }
.status-badge.pending { color: #8a6940 !important; }
.status-badge.pending::before { background: #d2a862; }
.empty-state { padding: 3rem; text-align: center; color: var(--muted); font-size: .85rem; }
.time-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(18rem, .65fr); gap: 1.5rem; align-items: start; }
.time-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.7rem 2rem; padding: 2rem; }
.time-form .button { margin-top: .5rem; }
.time-form select { appearance: none; background: linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - .8rem) calc(50% + 2px) / 5px 5px no-repeat, linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - .5rem) calc(50% + 2px) / 5px 5px no-repeat; }
.field-hint { display: block; margin-top: .4rem; color: var(--muted); font-size: .65rem; font-weight: 300; letter-spacing: 0; text-transform: none; }
.live-allowance { position: sticky; top: 2rem; padding: 2rem; }
.live-allowance > p { margin-top: .7rem; color: var(--muted); font-size: .75rem; }
.month-label { display: block; margin-top: 2.5rem; color: #527362; font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; }
.allowance-stats { margin-top: 1rem; border-top: 1px solid var(--border); }
.allowance-stats div { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--border); font-size: .78rem; }
.allowance-stats dt { color: var(--muted); }
.allowance-stats dd { font-weight: 400; }
.allowance-stats .remaining dd { color: #527362; font-size: 1rem; }
.live-progress { height: .3rem; margin-top: 1.4rem; overflow: hidden; background: var(--secondary); }
.live-progress span { display: block; height: 100%; background: var(--primary); }
.customer-dialog { width: min(100% - 2rem, 850px); max-height: calc(100vh - 2rem); padding: 0; border: 0; background: var(--background); color: var(--foreground); box-shadow: 0 30px 100px rgba(0,0,0,.2); }
.customer-dialog::backdrop { background: rgba(10,14,12,.58); backdrop-filter: blur(4px); }
.dialog-head { position: sticky; z-index: 3; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 4.5rem; padding: 0 2rem; border-bottom: 1px solid var(--border); background: rgba(249,248,246,.95); color: var(--muted); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; }
.dialog-head button { width: 2.5rem; height: 2.5rem; border: 0; background: none; font-size: 1.6rem; font-weight: 300; cursor: pointer; }
.dialog-body { padding: 3rem 2rem 4rem; }
.customer-detail-head { display: flex; align-items: start; justify-content: space-between; gap: 2rem; }
.customer-detail-head h2 { margin-top: .9rem; font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 300; letter-spacing: -.045em; }
.customer-detail-head p { margin-top: .6rem; color: var(--muted); font-size: .8rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 3rem; margin-top: 3rem; }
.detail-section { border-top: 1px solid var(--border); padding-top: 1.2rem; }
.detail-section h3 { color: var(--muted); font-size: .62rem; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
.detail-section dl { margin-top: 1rem; }
.detail-section dl div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; font-size: .75rem; }
.detail-section dt { color: var(--muted); }
.detail-section dd { text-align: right; }
.monthly-detail { margin-top: 3rem; padding: 1.5rem; border: 1px solid var(--border); background: white; }
.monthly-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.monthly-heading h3 { margin-top: .5rem; font-size: 1.35rem; font-weight: 400; }
.monthly-heading strong { color: #527362; font-size: 1.6rem; font-weight: 300; }
.detail-time-list { margin-top: 1.5rem; border-top: 1px solid var(--border); }
.detail-time-entry { display: grid; grid-template-columns: 5.3rem 6.5rem 1fr auto; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--border); font-size: .72rem; }
.detail-time-entry span { color: var(--muted); }
.detail-time-entry strong { font-weight: 400; }

@media (max-width: 1100px) {
  .admin-layout { grid-template-columns: 14rem minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .metric-grid div:nth-child(3) { border-right: 0; }
  .metric-grid div:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .admin-layout { display: block; }
  .admin-sidebar { position: fixed; inset: 0 auto 0 0; width: min(18rem, 88vw); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 25px 0 70px rgba(0,0,0,.18); }
  .admin-sidebar.is-open { transform: none; }
  .sidebar-close { display: block; }
  .admin-topbar { justify-content: space-between; padding-inline: 1.5rem; }
  .sidebar-open { display: flex; }
  #admin-main { padding: 3.5rem 1.5rem 5rem; }
  .admin-page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid div, .metric-grid div:nth-child(3) { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .metric-grid div:nth-child(even) { border-right: 0; }
  .metric-grid div:last-child { border-bottom: 0; }
  .time-layout { grid-template-columns: 1fr; }
  .live-allowance { position: static; }
  .admin-search input { width: min(100%, 24rem); }
}

@media (max-width: 560px) {
  .admin-topbar > div { display: none; }
  #admin-main { padding-inline: 1rem; }
  .admin-page-heading h1 { font-size: 2.7rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-grid div, .metric-grid div:nth-child(3), .metric-grid div:nth-child(even) { border-right: 0; }
  .compact-customer { grid-template-columns: 1fr auto; gap: .8rem; }
  .compact-customer > span, .compact-customer > div:nth-child(3) { display: none; }
  .time-form { grid-template-columns: 1fr; margin-inline: -1rem; padding: 1.5rem 1rem; border-right: 0; border-left: 0; }
  .time-form .field-wide { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .dialog-body { padding: 2rem 1rem 3rem; }
  .dialog-head { padding-inline: 1rem; }
  .customer-detail-head { flex-direction: column; }
  .detail-time-entry { grid-template-columns: 4.5rem 1fr auto; }
  .detail-time-entry span:nth-child(2) { display: none; }
}
