:root {
  --ink: #17211f;
  --muted: #697773;
  --line: #dfe7e3;
  --paper: #ffffff;
  --canvas: #f3f6f4;
  --navy: #102421;
  --navy-soft: #1b3530;
  --mint: #37d69b;
  --mint-dark: #148a65;
  --mint-pale: #e8fbf3;
  --blue: #4d8df7;
  --amber: #f2ac46;
  --rose: #e76f74;
  --shadow: 0 12px 35px rgba(31, 54, 48, .08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { margin: 0; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfb;
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, textarea:focus { border-color: var(--mint-dark); box-shadow: 0 0 0 3px rgba(55, 214, 155, .14); background: white; }
textarea { min-height: 235px; resize: vertical; line-height: 1.55; }
label > span { display: block; margin-bottom: 7px; font-size: .81rem; font-weight: 700; color: #41504c; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.55rem, 2vw, 2rem); letter-spacing: -.035em; margin-bottom: 0; }
h2 { font-size: 1.15rem; letter-spacing: -.02em; margin-bottom: 7px; }
.muted { color: var(--muted); line-height: 1.55; }
.eyebrow { margin-bottom: 7px; text-transform: uppercase; letter-spacing: .12em; font-size: .68rem; font-weight: 800; color: var(--mint-dark); }
.button { border: 0; border-radius: 11px; min-height: 42px; padding: 10px 17px; font-weight: 750; font-size: .86rem; transition: transform .15s, background .15s, box-shadow .15s; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { color: #092319; background: var(--mint); box-shadow: 0 8px 20px rgba(55, 214, 155, .2); }
.button-primary:hover:not(:disabled) { background: #4ee1aa; }
.button-secondary { color: #31413d; background: white; border: 1px solid var(--line); }
.button-dark { color: white; background: var(--navy); }
.button-danger { color: white; background: #c94d55; }
.button-danger-quiet { color: #a13e46; background: #fff3f3; border: 1px solid #f1d0d2; }
.button-wide { width: 100%; }
.text-button, .link-button { border: 0; color: var(--muted); background: transparent; padding: 5px; font-size: .8rem; font-weight: 700; }
.link-button { color: var(--mint-dark); }

/* Login */
.login-page { background: var(--navy); color: white; display: grid; place-items: center; padding: 28px; overflow: hidden; }
.login-page::before, .login-page::after { content: ""; position: fixed; border-radius: 50%; filter: blur(1px); pointer-events: none; }
.login-page::before { width: 520px; height: 520px; left: -170px; top: -230px; background: radial-gradient(circle, rgba(55,214,155,.22), transparent 66%); }
.login-page::after { width: 580px; height: 580px; right: -210px; bottom: -330px; background: radial-gradient(circle, rgba(77,141,247,.16), transparent 66%); }
.login-shell { width: min(1030px, 100%); display: grid; grid-template-columns: 1.15fr .85fr; gap: 60px; align-items: center; position: relative; z-index: 1; }
.login-brand h1 { font-size: clamp(2.3rem, 5vw, 4.6rem); line-height: 1.02; max-width: 700px; letter-spacing: -.055em; margin: 24px 0; }
.login-brand .eyebrow { color: var(--mint); }
.login-lead { max-width: 590px; color: #b9cbc5; font-size: 1.08rem; line-height: 1.7; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #072018; background: var(--mint); font-weight: 900; box-shadow: 0 10px 28px rgba(55,214,155,.22); }
.brand-mark-large { width: 58px; height: 58px; border-radius: 17px; font-size: 1.4rem; margin-bottom: 38px; }
.login-points { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 35px; }
.login-points span { border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.04); border-radius: 999px; padding: 8px 13px; color: #c6d6d1; font-size: .77rem; }
.login-card { color: var(--ink); background: white; border-radius: 24px; padding: clamp(25px, 4vw, 42px); box-shadow: 0 30px 80px rgba(0,0,0,.24); }
.login-card h2 { font-size: 1.7rem; margin-bottom: 5px; }
.stack-form { display: grid; gap: 17px; margin-top: 25px; }
.alert { padding: 12px 14px; border-radius: 10px; margin-top: 18px; font-size: .84rem; }
.alert-error { color: #8f3038; background: #fff0f1; border: 1px solid #f5ced1; }
.security-note { margin: 18px 0 0; text-align: center; color: #7f8b88; font-size: .73rem; }
.security-note span { color: var(--mint-dark); margin-right: 4px; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; padding: 25px 18px 18px; background: var(--navy); color: white; display: flex; flex-direction: column; z-index: 40; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 28px; }
.sidebar-brand div:last-child { display: grid; line-height: 1.08; }
.sidebar-brand strong { font-size: 1rem; }
.sidebar-brand span { color: #9ab0aa; font-size: .76rem; }
.main-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; border: 0; border-radius: 11px; padding: 11px 12px; background: transparent; color: #91a9a2; text-align: left; font-weight: 700; font-size: .83rem; transition: color .2s, background .2s; }
.nav-item > span { width: 24px; height: 24px; display: grid; place-items: center; color: #6f8a83; font-size: 1rem; }
.nav-item:hover { color: white; background: rgba(255,255,255,.045); }
.nav-item.active { color: white; background: var(--navy-soft); }
.nav-item.active > span { color: var(--mint); }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding: 18px 8px 3px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #2b4b45; color: var(--mint); font-weight: 800; }
.sidebar-user div { display: grid; }
.sidebar-user strong { font-size: .78rem; }
.sidebar-user div span { color: #7f9891; font-size: .67rem; }
.sidebar-footer .text-button { color: #7f9891; padding-left: 42px; }
.main-content { grid-column: 2; min-width: 0; padding: 0 34px 45px; }
.topbar { min-height: 105px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 30px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.connection-pill { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 12px; border: 1px solid var(--line); background: white; border-radius: 999px; font-size: .76rem; font-weight: 700; color: #51615d; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa5a2; }
.connection-pill.connected .status-dot { background: var(--mint); box-shadow: 0 0 0 4px rgba(55,214,155,.13); }
.connection-pill.disconnected .status-dot { background: var(--rose); }
.mobile-menu { display: none; border: 0; background: white; border-radius: 9px; width: 40px; height: 40px; }
.view { display: none; animation: fade-in .22s ease; }
.view.active { display: block; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Overview */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .7fr); gap: 18px; }
.control-card { min-height: 230px; color: white; background: linear-gradient(120deg, #102421, #1b3b34); border-radius: var(--radius); padding: 28px; display: grid; grid-template-columns: 1fr auto; align-items: center; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.control-card::after { content: ""; position: absolute; width: 290px; height: 290px; border-radius: 50%; right: -130px; bottom: -190px; background: rgba(55,214,155,.11); }
.control-copy { position: relative; z-index: 1; }
.control-copy .eyebrow { color: var(--mint); }
.control-copy h2 { font-size: clamp(1.55rem, 3vw, 2.25rem); max-width: 580px; margin-bottom: 10px; }
.control-copy .muted { color: #aabdb7; }
.pulse-orb { width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: #0a261d; font-size: 1.55rem; position: relative; z-index: 1; box-shadow: 0 0 0 12px rgba(55,214,155,.08); }
.pulse-orb.running { animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 20px rgba(55,214,155,0); } }
.control-actions { grid-column: 1 / -1; display: flex; gap: 10px; position: relative; z-index: 1; align-self: end; }
.control-actions .button-secondary { color: #c3d3ce; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.1); }
.next-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.now-row { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid #edf1ef; font-size: .8rem; }
.now-row span { color: var(--muted); }
.now-row strong { text-align: right; max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.countdown { margin-top: 17px; border-radius: 10px; background: var(--mint-pale); color: var(--mint-dark); padding: 10px 12px; font-size: .73rem; font-weight: 750; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.stat-card { display: flex; align-items: center; gap: 13px; background: white; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stat-icon { flex: 0 0 auto; width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; font-weight: 900; }
.stat-icon.mint { color: #167e5d; background: #e5f9f1; }.stat-icon.blue { color: #3c73cc; background: #eaf2ff; }.stat-icon.amber { color: #a86b15; background: #fff4df; }.stat-icon.rose { color: #a8484d; background: #feeaeb; }
.stat-card div { display: grid; gap: 3px; }.stat-card small { color: var(--muted); font-size: .68rem; }.stat-card strong { font-size: 1.28rem; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 8px 28px rgba(31,54,48,.045); }
.panel-heading { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }
.panel-badge, .info-chip { color: #5f706b; background: #f1f5f3; border-radius: 999px; padding: 7px 10px; font-size: .67rem; font-weight: 700; white-space: nowrap; }
.panel-badge.problem { color: #a43d45; background: #feeaeb; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.input-with-unit { position: relative; }.input-with-unit input { padding-right: 56px; }.input-with-unit em { position: absolute; right: 12px; top: 12px; color: #82908c; font-style: normal; font-size: .75rem; }
.switch-row { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0 3px; border-top: 1px solid #edf1ef; cursor: pointer; }
.switch-row > span { display: grid; margin: 0; }.switch-row small { color: var(--muted); font-weight: 500; margin-top: 3px; }
.switch-row input { position: absolute; opacity: 0; width: 1px; }.switch-row i { width: 43px; height: 24px; border-radius: 999px; background: #ccd5d1; position: relative; transition: background .2s; }
.switch-row i::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: white; transition: transform .2s; box-shadow: 0 2px 5px rgba(0,0,0,.14); }
.switch-row input:checked + i { background: var(--mint-dark); }.switch-row input:checked + i::after { transform: translateX(19px); }
.settings-grid > .button { grid-column: 1 / -1; justify-self: start; }
.activity-list { display: grid; gap: 3px; }
.activity-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid #edf1ef; }
.activity-item:last-child { border: 0; }.activity-status { width: 8px; height: 8px; border-radius: 50%; background: #9ba7a3; }.activity-status.success { background: var(--mint); }.activity-status.error { background: var(--rose); }.activity-status.warning { background: var(--amber); }
.activity-item p { margin: 0; font-size: .75rem; line-height: 1.3; }.activity-item small { color: var(--muted); font-size: .65rem; white-space: nowrap; }

/* Sections */
.section-intro { display: flex; justify-content: space-between; gap: 25px; align-items: end; margin-bottom: 22px; }
.section-intro h2 { font-size: 1.6rem; margin-bottom: 6px; }.section-intro p:last-child { margin-bottom: 0; }
.brand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.brand-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 8px 28px rgba(31,54,48,.045); }
.brand-stripe { height: 5px; background: var(--mint); }.brand-card:nth-child(2) .brand-stripe { background: var(--blue); }.brand-card:nth-child(3) .brand-stripe { background: var(--amber); }
.brand-card-body { padding: 20px; }.brand-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.brand-index { color: #93a09c; font-size: .65rem; font-weight: 800; letter-spacing: .12em; }.brand-card-head h3 { margin: 4px 0 0; font-size: 1.13rem; }
.brand-form { display: grid; gap: 14px; }.brand-form textarea { font-size: .79rem; }
.char-count { margin: -8px 2px 0; text-align: right; color: #8c9895; font-size: .65rem; }
.photo-row { display: flex; gap: 8px; align-items: center; }.file-button { position: relative; overflow: hidden; }.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-state { flex: 1; color: var(--muted); font-size: .71rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-actions { display: flex; gap: 8px; }.brand-actions .button:first-child { flex: 1; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 13px; align-items: end; }.inline-form small { color: #8b9693; font-weight: 500; }
.add-target-panel { margin-bottom: 18px; }.table-panel { padding: 0; overflow: hidden; }.table-panel > .panel-heading { padding: 21px 22px 0; }
.target-list { border-top: 1px solid var(--line); }.target-row { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(150px, .8fr) auto auto; align-items: center; gap: 13px; padding: 13px 22px; border-bottom: 1px solid #edf1ef; }
.target-row:last-child { border: 0; }.target-primary { display: grid; gap: 3px; min-width: 0; }.target-primary strong { overflow: hidden; text-overflow: ellipsis; }.target-primary small { color: var(--muted); }.target-row input { padding: 9px 10px; }
.target-name-line { display: flex; align-items: center; gap: 7px; min-width: 0; }
.target-failure-badge { flex: 0 0 auto; width: 19px; height: 19px; display: inline-grid; place-items: center; border-radius: 50%; color: white; background: #cf4e56; font-size: .72rem; font-weight: 900; box-shadow: 0 0 0 4px rgba(207,78,86,.1); cursor: help; }
.target-failure-badge:focus { outline: 3px solid rgba(207,78,86,.22); outline-offset: 2px; }
.target-failure-reason { margin: 5px 0 0; max-width: 520px; color: #9f3e45; font-size: .68rem; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-failure-reason span { font-weight: 800; }
.target-row .switch-row { grid-column: auto; padding: 0; border: 0; }
.row-actions { display: flex; gap: 6px; }.icon-button { border: 1px solid var(--line); background: white; color: #66736f; min-width: 34px; height: 34px; border-radius: 9px; font-weight: 800; }.icon-button.danger { color: #bd4c53; background: #fff7f7; }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); }.empty-state strong { display: block; color: var(--ink); margin-bottom: 5px; }
.account-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; }.account-status-card { display: flex; flex-direction: column; gap: 20px; }.account-hero { display: flex; align-items: center; gap: 15px; }.account-avatar { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 17px; background: var(--mint-pale); color: var(--mint-dark); font-size: 1.25rem; font-weight: 900; }.status-label { color: var(--muted); font-size: .69rem; }.account-hero h2 { margin: 3px 0; font-size: 1.35rem; }.account-hero p { margin: 0; }.account-security { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: #f3f8f6; }.account-security > span { color: var(--mint-dark); font-weight: 900; }.account-security p { margin: 0; display: grid; gap: 3px; font-size: .77rem; }.account-security small { color: var(--muted); line-height: 1.45; }.account-status-card .button { margin-top: auto; align-self: flex-start; }
.connect-card { padding: 28px; }.connect-card h2 { font-size: 1.4rem; }.login-step { display: none; }.login-step.active { display: block; }.connect-card .stack-form { max-width: 520px; }
.activity-table-wrap { overflow: auto; }.activity-table { width: 100%; border-collapse: collapse; font-size: .75rem; }.activity-table th { color: #71807c; background: #f7f9f8; text-align: left; padding: 12px 16px; font-size: .66rem; text-transform: uppercase; letter-spacing: .07em; }.activity-table td { padding: 13px 16px; border-top: 1px solid #edf1ef; vertical-align: top; }.activity-table .detail-cell { min-width: 260px; max-width: 460px; line-height: 1.45; }.status-tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; font-weight: 750; font-size: .64rem; background: #eef2f0; }.status-tag.success { color: #167e5d; background: #e5f9f1; }.status-tag.error { color: #a8484d; background: #feeaeb; }.status-tag.warning { color: #9a671d; background: #fff4df; }

/* Feedback */
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { color: white; background: #172a26; border-radius: 12px; padding: 13px 15px; box-shadow: 0 18px 42px rgba(0,0,0,.22); font-size: .8rem; animation: toast-in .25s ease; }.toast.error { background: #9f3e45; }.toast.success { border-left: 4px solid var(--mint); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(7,20,17,.64); z-index: 120; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); }.modal-backdrop[hidden] { display: none; }.modal { width: min(430px, 100%); background: white; border-radius: 18px; padding: 28px; text-align: center; box-shadow: 0 30px 70px rgba(0,0,0,.25); }.modal-icon { margin: 0 auto 14px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #fff0f1; color: #bd4c53; font-weight: 900; }.modal p { color: var(--muted); line-height: 1.55; }.modal-actions { display: flex; justify-content: center; gap: 9px; margin-top: 22px; }
.loading { opacity: .65; pointer-events: none; }

@media (max-width: 1100px) {
  .brand-grid { grid-template-columns: 1fr; }
  .brand-form { grid-template-columns: 1fr 1fr; }.brand-form label:nth-child(2) { grid-column: 1 / -1; }.brand-actions, .photo-row, .char-count { grid-column: 1 / -1; }
  .content-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .app-shell { display: block; }.sidebar { transform: translateX(-105%); transition: transform .25s; box-shadow: 20px 0 50px rgba(0,0,0,.22); }.sidebar.open { transform: none; }.main-content { padding: 0 18px 35px; }.mobile-menu { display: inline-grid; place-items: center; }.topbar { min-height: 84px; }.topbar > div:nth-child(2) { margin-right: auto; }.topbar .eyebrow { display: none; }.topbar-actions .connection-pill { display: none; }
  .hero-grid, .account-grid { grid-template-columns: 1fr; }.control-card { grid-template-columns: 1fr; }.pulse-orb { display: none; }.control-actions { margin-top: 25px; }
  .inline-form { grid-template-columns: 1fr; }.target-row { grid-template-columns: 1fr auto; }.target-row > input { grid-column: 1 / -1; }.target-primary { grid-column: 1 / 2; }
  .login-shell { grid-template-columns: 1fr; }.login-brand { display: none; }
}
@media (max-width: 560px) {
  .login-page { padding: 14px; }.login-card { border-radius: 18px; }
  .topbar-actions .button { min-height: 38px; padding: 8px 11px; }.topbar h1 { font-size: 1.35rem; }.topbar { gap: 10px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }.stat-card { padding: 12px; }.stat-icon { display: none; }
  .settings-grid { grid-template-columns: 1fr; }.settings-grid > *, .switch-row, .settings-grid > .button { grid-column: 1; }
  .section-intro { align-items: flex-start; flex-direction: column; }.info-chip { white-space: normal; }
  .brand-form { grid-template-columns: 1fr; }.brand-form > *, .brand-form label:nth-child(2), .brand-actions, .photo-row, .char-count { grid-column: 1; }
  .control-actions { flex-direction: column; }.control-actions .button { width: 100%; }
  .panel { padding: 18px; }.target-row { padding: 13px 16px; }
}
