:root{
  --ink:#17211d;
  --muted:#6d7772;
  --line:#e4e9e6;
  --paper:#f5f7f5;
  --green:#155c42;
  --lime:#cde851;
  --orange:#ee8d3d;
  --red:#c95349;
  --shadow:0 14px 36px rgba(26,48,39,.08);
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:"Yu Gothic UI","Noto Sans JP",sans-serif;
  color:var(--ink);
  background:var(--paper);
  overflow-x:hidden;
}

button,input,select{font:inherit}

.auth-screen{
  min-height:100vh;
  display:grid;
  grid-template-columns:1fr 1fr;
  background:#fcfdfc;
}

.auth-card{
  max-width:600px;
  padding:10vh 7vw;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
}

.logo{font:bold 24px/1 Arial;letter-spacing:-1px}
.logo span{display:block;font:600 9px/1.8 Arial;letter-spacing:2.7px;color:var(--green)}

.auth-card h1{
  font-size:clamp(40px,5vw,68px);
  letter-spacing:-.055em;
  line-height:1.14;
  margin:64px 0 22px;
}

.auth-card p{max-width:520px;color:var(--muted);line-height:2}
.auth-card button{
  width:100%;
  max-width:420px;
  padding:16px;
  border-radius:9px;
  margin-top:25px;
  cursor:pointer;
}

.primary{color:#fff;background:var(--green);border:1px solid var(--green);font-weight:700}
.preview{background:white;border:1px solid var(--line)!important;margin-top:10px!important}
.auth-card small{color:#8a938f;margin:20px auto 0}

.auth-visual{
  position:relative;
  overflow:hidden;
  background:#183c30;
  color:white;
  display:grid;
  place-items:end start;
  padding:60px;
}

.auth-visual:before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(135deg,transparent,rgba(205,232,81,.1));
}

.auth-visual p{font-size:13px;letter-spacing:4px}

.orb{position:absolute;border-radius:50%;filter:blur(2px)}
.orb.one{width:38vw;height:38vw;background:var(--lime);top:-5vw;right:-15vw}
.orb.two{width:22vw;height:22vw;border:1px solid rgba(255,255,255,.4);bottom:12%;left:15%}

.app{
  display:grid;
  grid-template-columns:240px 1fr;
  min-height:100vh;
  margin:0 auto;
  width:min(100vw, 1520px);
}

aside{
  position:sticky;
  top:0;
  height:100vh;
  background:#133b2d;
  color:white;
  padding:30px 22px;
  display:flex;
  flex-direction:column;
}

aside .logo{padding:4px 12px 38px}
aside .logo span{color:var(--lime)}

nav{display:grid;gap:7px}
nav button{
  display:flex;
  justify-content:space-between;
  border:0;
  background:transparent;
  color:#c8d5d0;
  text-align:left;
  padding:13px 14px;
  border-radius:8px;
  cursor:pointer;
}
nav button.active,nav button:hover{color:white;background:rgba(255,255,255,.1)}
nav b{background:var(--orange);color:white;border-radius:12px;padding:1px 7px;font-size:11px}

.side-footer{
  margin-top:auto;
  display:flex;
  gap:10px;
  align-items:center;
  padding:18px 8px 0;
  border-top:1px solid rgba(255,255,255,.12);
}

.side-footer div{min-width:0}
.side-footer strong,.side-footer small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:11px}
.side-footer small{color:#a9bbb4;margin-top:4px}
.avatar{
  display:grid;
  place-items:center;
  width:34px;height:34px;
  background:var(--lime);
  color:var(--green);
  border-radius:50%;
  font-weight:bold;
}

main{min-width:0;padding:0 4vw 60px}
header{height:110px;display:flex;align-items:center;justify-content:space-between}
header h1{margin:4px 0;font-size:27px}

.eyebrow{font:700 10px Arial;letter-spacing:2.2px;color:var(--green);margin:0}
.header-actions{display:flex;gap:8px;align-items:center}
.header-actions button,.panel-head button{
  background:white;
  border:1px solid var(--line);
  border-radius:7px;
  padding:8px 12px;
  cursor:pointer;
}

.updated{font-size:11px;color:var(--muted);margin-right:10px}
.page{display:none}
.page.active{display:block}

.welcome{display:flex;justify-content:space-between;align-items:end;margin:10px 0 25px}
.welcome p{margin:0;color:var(--muted)}
.welcome h2{font-size:30px;margin:4px 0}
.live{font-size:12px;color:var(--green)}
.live i{
  display:inline-block;
  width:7px;height:7px;
  border-radius:50%;
  background:#38a872;
  margin-right:6px;
  box-shadow:0 0 0 4px #d9eee5;
}

.metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:14px}
.metric,.panel{
  background:white;
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:var(--shadow);
}

.metric{padding:20px}
.metric p{margin:0;color:var(--muted);font-size:12px}
.metric strong{display:block;font-size:27px;margin-top:13px}
.metric small{color:var(--muted)}

.grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.panel{padding:22px}
.span-2{grid-column:span 2}

.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.panel h2{font-size:18px;margin:5px 0}
.panel-head button{font-size:12px}

.progress-row{
  display:grid;
  grid-template-columns:120px 1fr 90px;
  align-items:center;
  gap:15px;
  margin:12px 0;
  font-size:12px;
}
.track{height:7px;background:#edf0ee;border-radius:8px;overflow:hidden}
.track i{display:block;height:100%;background:var(--green);border-radius:8px}
.progress-row.warn i{background:var(--orange)}

.mini-list,.messages,.attention{display:grid;gap:0}
.mini-item,.message,.attention-item{
  display:grid;
  grid-template-columns:1fr auto;
  gap:14px;
  padding:14px 0;
  border-top:1px solid var(--line);
}
.mini-item small,.message small,.attention-item small{color:var(--muted)}
.message.unread{border-left:3px solid var(--lime);padding-left:12px}
.message p{margin:5px 0;line-height:1.6;font-size:13px}

.badge{
  display:inline-block;
  padding:4px 9px;
  border-radius:20px;
  background:#edf4f0;
  color:var(--green);
  font-size:11px;
}
.badge.warn{background:#fff1e5;color:#a55110}
.badge.error{background:#fcecea;color:#a23a33}

.invoice-card{
  background:#f6f8f6;
  padding:18px;
  border-radius:8px;
  display:grid;
  grid-template-columns:1fr auto;
  align-items:center;
}
.invoice-card strong{font-size:22px}

.toolbar{display:flex;gap:10px;margin:8px 0 18px}
.toolbar input,.toolbar select{
  border:1px solid var(--line);
  background:white;
  padding:12px 14px;
  border-radius:8px;
  min-width:260px;
}

.table-summary{
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background:#ffffff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  box-shadow: var(--shadow);
}

.chip{border:1px solid var(--line);border-radius:20px;background:white;padding:8px 14px}
.chip.active{background:var(--green);color:white}

.table-panel{padding:0;overflow:auto}
.data-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:820px;
}

.data-table thead th{
  position:sticky;
  top:0;
  z-index:1;
  background:#fcfdfb;
  color:var(--muted);
  font-size:11px;
  letter-spacing:.04em;
  text-transform:none;
  padding:12px 14px;
  border-bottom:1px solid var(--line);
}

.data-table tbody td{
  padding:14px;
  border-bottom:1px solid var(--line);
  font-size:13px;
  vertical-align:top;
  white-space:nowrap;
}

.data-table tbody td.amount,
.data-table thead th.amount{
  text-align:right;
}

.data-table tbody td.status{
  width:120px;
}

.data-table thead th.action{
  width:96px;
}

.data-table tbody tr{
  transition:background .15s ease;
}

.data-table tbody tr:nth-child(odd){background:#fcfdfc}
.data-table tbody tr:hover{background:#f5faf6}

.data-table tbody tr.row-warning td{background:linear-gradient(90deg,rgba(255,235,214,.28),transparent)}
.data-table tbody tr.row-error td{background:linear-gradient(90deg,rgba(252,236,234,.28),transparent)}

td strong{display:block}
td small{color:var(--muted)}

.link-button{border:1px solid var(--line);background:white;border-radius:6px;padding:7px 10px}

.discount-status{display:grid;gap:12px}
.discount-hero{
  padding:26px 28px;
  background:linear-gradient(160deg,#ffffff 10%,#f5fcf6 100%);
  border-color:#cae6d8;
  box-shadow:0 16px 40px rgba(25,54,41,.1);
  min-height: 420px;
}

/* panel order is controlled by HTML order: capacity, then special pricing */

.discount-hero .panel-head{
  margin-bottom:14px;
}

.discount-hero .panel-head p{
  font-size:11px;
  letter-spacing:2.8px;
}

.discount-hero .panel-head h2{
  font-size:26px;
  letter-spacing:-.025em;
}

.discount-hero .discount-status{
  gap:16px;
}

.discount-overview-wrap{margin-top:10px}
.discount-overview-wrap .data-table{
  width:min(100%, 1100px);
  border-collapse:separate;
  border-spacing:0;
  border-radius:14px;
  background:white;
  border:1px solid #d8e3dc;
  overflow:hidden;
  margin:0 auto;
  max-width: 1100px;
  table-layout: fixed;
}
.discount-overview-wrap .data-table thead th{
  background:#ecf5ee;
  color:#23423a;
  font-size:14px;
  font-weight:700;
  letter-spacing:.03em;
  padding:16px 12px;
  white-space:nowrap;
}

.discount-overview-wrap .data-table thead th:nth-child(3),
.discount-overview-wrap .data-table tbody td:nth-child(3){
  text-align:right;
}

.discount-overview-wrap .data-table thead th:nth-child(4),
.discount-overview-wrap .data-table tbody td:nth-child(4){
  text-align:right;
}

.discount-overview-wrap .data-table tbody td:last-child{
  min-width:420px;
}

.discount-overview-wrap .data-table thead th:last-child{
  text-align:center;
}

.discount-overview-wrap .data-table tbody tr{
  transition:background .2s ease;
}

.discount-overview-wrap .data-table tbody td{
  padding:14px 12px;
  font-size:15px;
  line-height:1.45;
  height:auto;
}

.discount-overview-wrap .data-table thead th:first-child,
.discount-overview-wrap .data-table tbody td:first-child{
  width:9%;
  color:#1d2f28;
}

.discount-overview-wrap .data-table tbody td:first-child{
  font-size:16px;
}

.discount-overview-wrap .data-table thead th:last-child,
.discount-overview-wrap .data-table tbody td:last-child{
  width:42%;
}

.discount-overview-wrap .data-table thead th:nth-child(2),
.discount-overview-wrap .data-table tbody td:nth-child(2),
.discount-overview-wrap .data-table thead th:nth-child(3),
.discount-overview-wrap .data-table tbody td:nth-child(3),
.discount-overview-wrap .data-table thead th:nth-child(4),
.discount-overview-wrap .data-table tbody td:nth-child(4){
  width:16%;
}

.discount-overview-wrap .data-table tbody td.amount{
  font-size:19px;
  font-weight:700;
  line-height:1.2;
  color:#103726;
  white-space:nowrap;
}

.discount-overview-wrap .data-table tbody .summary-status{
  display:inline;
  min-width:auto;
  width:auto;
  text-align:left;
  border:0;
  background:none;
  padding:0;
  box-shadow:none;
  line-height:1.45;
}

.discount-overview-wrap .data-table .summary-lines{
  display:block;
  width:100%;
  overflow:hidden;
  line-height:1.55;
  white-space:normal;
}

.discount-overview-wrap .data-table .summary-line{
  display:block;
  margin:0;
  width:100%;
  color:#1e2f29;
  font-size:15px;
}

.discount-overview-wrap .data-table tbody tr.discount-row td:last-child{
  white-space:normal;
}

.discount-overview-wrap .data-table tbody tr.discount-row td:last-child *{
  white-space:normal;
  word-break:break-word;
}

.discount-overview-wrap .data-table .summary-line .delta-positive{
  color:#0b63d9;
}

.discount-overview-wrap .data-table .summary-line .delta-negative{
  color:#d33;
}

.discount-overview-wrap .data-table tbody tr.discount-row.ok{ background:#f1fbf4; }
.discount-overview-wrap .data-table tbody tr.discount-row.warn{ background:#fff7ef; }
.discount-overview-wrap .data-table tbody tr.discount-row.error{ background:#fff3f2; }

.discount-overview-wrap .data-table tbody tr.discount-row.ok td.amount{
  color:#0f4d33;
}

.discount-overview-wrap .data-table tbody tr.discount-row.warn td.amount{
  color:#8c4c15;
}

.discount-overview-wrap .data-table tbody tr.discount-row.error td.amount{
  color:#9a2e23;
}

.discount-overview-wrap .data-table tbody tr.discount-row.ok td{
  background:#f2fbf5;
}
.discount-overview-wrap .data-table tbody tr.discount-row.warn td{
  background:#fff8ef;
}
.discount-overview-wrap .data-table tbody tr.discount-row.error td{
  background:#fff3f2;
}

.discount-status .state{
  padding:12px 14px;
  border-radius:10px;
  border:1px solid var(--line);
  font-size:13px;
}

.discount-hero .discount-status .state{
  padding:16px 20px;
  border-radius:12px;
}

.discount-hero .discount-status .state strong{
  font-size:18px;
}

.discount-hero #discount-status .state p{
  margin:0 0 5px;
  line-height:1.4;
}

.discount-hero #discount-status .state p:last-child{
  margin-bottom:0;
}

.special-rate-copy p{
  margin:0 0 5px;
  line-height:1.4;
}

.special-rate-copy p:last-child{
  margin-bottom:0;
}

.discount-hero .discount-status .state div{
  font-size:34px;
  margin:10px 0;
  line-height:1.2;
}

.discount-hero .discount-status .state small{
  font-size:13px;
}

.discount-status .state.ok{background:#f3fbf5;border-color:#c9e8d0;color:#14523e}
.discount-status .state.warn{background:#fff7ef;border-color:#f5d5b8;color:#8f4b1f}
.discount-status .state.info{background:#f6f8f6;color:var(--muted)}
.discount-status small{color:var(--muted)}

.summary-status{
  display:inline;
  padding:0;
  border-radius:0;
  font-size:15px;
  font-weight:700;
  border:0;
  background:transparent;
  box-shadow:none;
}
.summary-status.ok{
  background:transparent;
  color:#14523e;
}
.summary-status.warn{
  background:transparent;
  color:#9a4f1f;
}

.toast{
  position:fixed;
  right:30px;
  bottom:30px;
  background:#17211d;
  color:white;
  border-radius:8px;
  padding:12px 18px;
  opacity:0;
  transform:translateY(10px);
  transition:.2s;
  pointer-events:none;
}
.toast.show{opacity:1;transform:none}

@media(max-width:900px){
  .auth-screen{grid-template-columns:1fr}
  .auth-visual{display:none}
  .app{grid-template-columns:1fr}
  aside{position:static;height:auto;padding:18px}
  aside nav{display:flex;overflow:auto}
  .side-footer{display:none}
  main{padding:0 18px 40px}
  .metrics{grid-template-columns:1fr 1fr}
  .grid{grid-template-columns:1fr}
  .span-2{grid-column:auto}
  header{height:auto;padding:24px 0}
  .updated{display:none}
  .discount-overview-wrap .data-table thead th,
  .discount-overview-wrap .data-table tbody td{
    padding:10px 8px;
    font-size:13px;
  }
  .discount-overview-wrap .data-table tbody td.amount{
    font-size:17px;
  }
  .discount-hero .panel-head h2{
    font-size:22px;
  }
  .discount-hero .discount-status .state div{
    font-size:28px;
  }

  .capacity-panel,
  .special-rate-panel{
    order: initial;
  }
}

@media(max-width:560px){
  .metrics{grid-template-columns:1fr}
  .header-actions button:last-child{display:none}
  .progress-row{grid-template-columns:90px 1fr}
  .progress-row>strong{display:none}
}

[hidden]{display:none!important}

.auth-message{margin-top:18px;color:var(--muted);font-size:13px}
.access-layout{display:grid;grid-template-columns:360px minmax(0,1fr);gap:18px;align-items:start}
.access-form{display:grid;gap:14px;margin-top:18px}
.access-form>label{display:grid;gap:6px;color:var(--muted);font-size:12px;font-weight:700}
.access-form input,.access-form select{width:100%;border:1px solid var(--line);border-radius:9px;background:#fff;padding:11px 12px;color:var(--ink);font:inherit}
.access-form fieldset{display:grid;grid-template-columns:1fr 1fr;gap:8px;border:1px solid var(--line);border-radius:10px;padding:12px}
.access-form legend{padding:0 5px;color:var(--muted);font-size:12px;font-weight:700}
.access-form .permission-check{display:flex;align-items:center;gap:7px;color:var(--ink);font-size:13px;font-weight:600}
.access-form .permission-check input{width:auto}
.access-form .active-check{padding:10px 12px;border-radius:9px;background:#f2f8f4}
.form-message{min-height:20px;color:var(--muted);font-size:12px}
.form-message.error{color:#b6332a}
.access-list-panel{min-width:0}
.access-table td:first-child{font-weight:700}
.access-table .permission-tags{display:flex;flex-wrap:wrap;gap:4px}
.access-table .permission-tags span{padding:3px 7px;border-radius:99px;background:#edf5f0;color:#24553f;font-size:11px;font-weight:700}
.access-table button{white-space:nowrap}
@media(max-width:1100px){.access-layout{grid-template-columns:1fr}.access-form-panel{max-width:none}}
