:root {
  color-scheme: dark;
  --page: #0d0f11;
  --panel: #15181b;
  --panel-2: #1b1f23;
  --panel-3: #22272c;
  --line: #2b3137;
  --line-soft: rgba(255,255,255,.075);
  --text: #f3f5f6;
  --muted: #90989f;
  --green: #2dbe64;
  --green-light: #6de698;
  --green-soft: rgba(45,190,100,.13);
  --amber: #e3b85c;
  --amber-soft: rgba(227,184,92,.12);
  --danger: #ff7777;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(circle at 70% -10%, #252a2e 0, transparent 34rem), var(--page); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.eyebrow { margin: 0 0 8px; color: var(--green-light); font-size: 11px; font-weight: 850; letter-spacing: .15em; }

.brand-mark { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 23px; border: 1px solid #3b4248; border-radius: 16px; background: linear-gradient(145deg, #2b3135, #171a1d); color: var(--green-light); font-size: 17px; font-weight: 950; box-shadow: inset 0 1px 0 #ffffff10, 0 14px 30px #0006; }
.brand-mark.small { width: 42px; height: 42px; flex: 0 0 42px; margin: 0; border-radius: 13px; font-size: 14px; }

.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); }
.login-card { width: min(100%, 420px); padding: 31px; border: 1px solid var(--line); border-radius: 26px; background: linear-gradient(150deg, rgba(31,35,39,.98), rgba(18,21,23,.98)); box-shadow: 0 30px 100px #000a; }
.login-card h1 { margin: 0; font-size: clamp(38px, 11vw, 55px); letter-spacing: -.065em; line-height: .95; }
.lead { margin: 13px 0 29px; color: var(--muted); font-size: 14px; line-height: 1.5; }
form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; }
label > span { color: #b7bdc2; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: #101315; color: var(--text); }
input, select { height: 50px; padding: 0 14px; }
select { appearance: none; -webkit-appearance: none; padding-right: 45px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236de698' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-position: right 15px center; background-repeat: no-repeat; }
textarea { min-height: 112px; padding: 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(109,230,152,.68); box-shadow: 0 0 0 3px rgba(45,190,100,.1); }
.primary-button { min-height: 50px; border: 0; border-radius: 13px; background: var(--green); color: #07150c; font-weight: 900; }
.primary-button:disabled { opacity: .55; cursor: wait; }
.form-message { min-height: 18px; margin: 0; color: var(--danger); font-size: 13px; line-height: 1.4; }
.form-message.is-success { color: var(--green-light); }

.topbar { min-height: calc(72px + env(safe-area-inset-top)); display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: env(safe-area-inset-top) max(20px, calc((100vw - 1180px) / 2)) 13px; border-bottom: 1px solid var(--line-soft); background: rgba(13,15,17,.86); backdrop-filter: blur(20px); }
.brand { min-width: 0; display: flex; align-items: center; gap: 12px; }
.brand > div:last-child { min-width: 0; display: grid; gap: 2px; }
.brand strong { font-size: 17px; letter-spacing: -.03em; }
.brand span { color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.sync-state { color: var(--muted); font-size: 11px; white-space: nowrap; }
.ghost-button { min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: #c7ccd0; font-size: 12px; font-weight: 750; }

.workspace { width: min(100%, 1180px); margin: 0 auto; padding: 55px 20px max(70px, env(safe-area-inset-bottom)); }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.hero h1 { margin: 0; font-size: clamp(48px, 8vw, 78px); line-height: .9; letter-spacing: -.075em; }
.hero p:last-child { max-width: 620px; margin: 17px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.create-button { min-height: 52px; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 9px; padding: 0 19px; border: 1px solid rgba(109,230,152,.35); border-radius: 14px; background: var(--green); color: #07150c; font-size: 14px; font-weight: 900; box-shadow: 0 13px 35px rgba(45,190,100,.15); }
.create-button span { font-size: 22px; font-weight: 500; }
.page-message { min-height: 20px; margin: 20px 0 0; color: var(--danger); font-size: 13px; }

.summary { display: grid; grid-template-columns: 1fr 1fr 1.45fr; gap: 10px; margin-top: 25px; }
.summary article { min-height: 112px; display: grid; align-content: space-between; padding: 17px 18px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, var(--panel-2), var(--panel)); box-shadow: inset 0 1px 0 #ffffff08; }
.summary span { color: var(--muted); font-size: 12px; }
.summary strong { color: var(--green-light); font-size: 34px; line-height: 1; letter-spacing: -.04em; }
.summary strong.summary-time { color: var(--text); font-size: 17px; letter-spacing: -.02em; }

.limits-section { margin-top: 44px; }
.archive-section { padding-top: 41px; border-top: 1px solid var(--line-soft); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.section-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--green-light); font-size: 11px; font-weight: 800; }
.status-dot::before { width: 7px; height: 7px; content: ""; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(45,190,100,.1); }
.limit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.limit-card { min-width: 0; padding: 19px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, var(--panel-2), var(--panel)); box-shadow: inset 0 1px 0 #ffffff08; }
.limit-card.is-active { border-color: rgba(227,184,92,.35); }
.limit-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.limit-heading h3 { margin: 0; font-size: 17px; letter-spacing: -.025em; }
.limit-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.limit-value { flex: 0 0 auto; padding: 7px 10px; border-radius: 10px; background: var(--green-soft); color: var(--green-light); font-size: 13px; font-weight: 900; }
.limit-card.is-active .limit-value { background: var(--amber-soft); color: #f2cd7d; }
.limit-comment { margin: 17px 0; color: #e0e3e5; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.limit-meta { display: grid; gap: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.delete-button { min-height: 36px; margin-top: 16px; padding: 0 12px; border: 1px solid rgba(255,119,119,.28); border-radius: 10px; background: rgba(255,119,119,.06); color: #ff9a9a; font-size: 11px; font-weight: 800; }
.empty-state { grid-column: 1 / -1; margin: 0; padding: 35px 20px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.74); backdrop-filter: blur(9px); }
.modal { width: min(100%, 560px); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 25px; border: 1px solid #363d43; border-radius: 24px; background: linear-gradient(155deg, #202428, #131618); box-shadow: 0 30px 100px #000c; }
.modal-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.modal-head h2 { margin: 0; font-size: 30px; letter-spacing: -.05em; }
.close-button { width: 40px; height: 40px; flex: 0 0 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--muted); font-size: 23px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.expiry-preview { margin: -3px 0 0; color: #f2cd7d; font-size: 12px; line-height: 1.45; }

@media (max-width: 720px) {
  .topbar { align-items: center; padding-bottom: 11px; }
  .sync-state { display: none; }
  .workspace { padding-top: 37px; }
  .hero { align-items: flex-start; }
  .hero p:last-child { font-size: 13px; }
  .create-button { min-height: 46px; padding-inline: 14px; }
  .summary { grid-template-columns: 1fr 1fr; }
  .summary article:last-child { grid-column: 1 / -1; min-height: 92px; }
  .limit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .login-card { padding: 25px 20px; }
  .brand span { display: none; }
  .workspace { padding-inline: 15px; }
  .hero { display: grid; }
  .hero h1 { font-size: 53px; }
  .create-button { width: 100%; justify-content: center; }
  .summary article { min-height: 100px; padding: 15px; }
  .summary strong { font-size: 29px; }
  .field-grid { grid-template-columns: 1fr; }
  .modal-backdrop { place-items: end center; padding: 20px 0 0; }
  .modal { max-height: calc(100dvh - 20px); padding: 23px 18px max(25px, env(safe-area-inset-bottom)); border-bottom: 0; border-radius: 24px 24px 0 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
