:root {
  color-scheme: dark;
  --ink: #f5f0e6;
  --muted: #a8afa9;
  --panel: rgba(23, 30, 34, 0.92);
  --panel-deep: #12191d;
  --line: rgba(217, 228, 217, 0.14);
  --sage: #b7df9a;
  --lime: #d3ef5c;
  --orange: #ffb96d;
  --danger: #ff8989;
  font-family: "Aptos", "Segoe UI", sans-serif;
  background: #071011;
  color: var(--ink);
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(178, 231, 139, 0.16), transparent 27rem),
    radial-gradient(circle at 93% 10%, rgba(252, 174, 94, 0.14), transparent 26rem),
    linear-gradient(135deg, #071011 0%, #10191a 52%, #091313 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 20px 20px;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.62; }
[hidden] { display: none !important; }

.shell { width: min(1180px, calc(100% - 34px)); margin: 0 auto; padding: 42px 0 68px; }
.masthead { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid rgba(222, 242, 205, 0.4); border-radius: 13px;
  background: linear-gradient(135deg, #b9ed7a, #e6b779); color: #18210d;
  font-size: 14px; font-weight: 900; letter-spacing: 0.08em;
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.7rem, 3vw, 2.35rem); letter-spacing: -0.04em; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.45rem; letter-spacing: -0.03em; }
h3 { font-size: 1.08rem; }
.eyebrow { color: var(--sage); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.text-button { margin-left: auto; border: 0; background: transparent; color: var(--muted); padding: 8px; }
.text-button:hover { color: var(--ink); }

.login-panel, .overview-card, .upload-panel, .release-panel {
  border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 22px 54px rgba(0, 0, 0, 0.22);
}
.login-panel { display: grid; grid-template-columns: 1fr minmax(270px, 0.72fr); gap: 28px; max-width: 780px; padding: clamp(24px, 5vw, 48px); }
.panel-intro h2 { margin: 8px 0 12px; font-size: clamp(1.7rem, 4vw, 2.35rem); }
.panel-intro p:last-child { color: var(--muted); line-height: 1.55; max-width: 37rem; }
.login-form { align-self: center; }

label { display: grid; gap: 7px; color: #e7eadf; font-size: 0.84rem; font-weight: 700; }
small { color: var(--muted); font-size: 0.75rem; font-weight: 500; }
input, select, textarea {
  width: 100%; border: 1px solid rgba(229, 238, 223, 0.16); border-radius: 11px;
  background: rgba(6, 12, 14, 0.45); color: var(--ink); padding: 11px 12px;
  outline: none; transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea { resize: vertical; min-height: 116px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: rgba(205, 238, 127, 0.8); box-shadow: 0 0 0 3px rgba(195, 231, 100, 0.13); }
select option { background: #172024; }
input[type="file"] { padding: 9px; font-size: 0.78rem; }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 6px 9px; border: 0; border-radius: 7px; background: #3d5440; color: #fff; font-weight: 700; }

.primary-button, .secondary-button, .danger-button {
  border-radius: 10px; padding: 10px 15px; font-size: 0.84rem; font-weight: 800; transition: transform 160ms ease, filter 160ms ease;
}
.primary-button { border: 0; background: linear-gradient(105deg, var(--lime), #a8d990); color: #152110; }
.secondary-button { border: 1px solid rgba(231, 239, 223, 0.22); background: rgba(255, 255, 255, 0.045); color: var(--ink); }
.danger-button { border: 1px solid rgba(255, 136, 136, 0.35); background: rgba(109, 27, 31, 0.28); color: #ffc1c1; }
.primary-button:hover, .secondary-button:hover, .danger-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.form-message { min-height: 1.1rem; margin-top: 10px; color: var(--muted); font-size: 0.82rem; }
.form-message.error { color: #ffb2ab; }
.form-message.success { color: #bff19d; }

.overview-grid { display: grid; grid-template-columns: minmax(220px, 0.65fr) minmax(350px, 1fr); gap: 14px; margin-bottom: 14px; }
.overview-card { padding: 20px; }
.overview-value { margin: 10px 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; color: var(--lime); }
.overview-card p:last-child { color: var(--muted); font-size: 0.84rem; line-height: 1.45; }
.contract-summary code { display: block; margin: 10px 0 8px; overflow-x: auto; color: #f2d694; font-size: 0.8rem; white-space: nowrap; }

.workspace-grid { display: grid; grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr); gap: 14px; align-items: start; }
.upload-panel, .release-panel { padding: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.section-heading h2 { margin-top: 5px; }
.file-types { border: 1px solid rgba(212, 239, 153, 0.22); border-radius: 999px; color: var(--sage); padding: 6px 9px; font-size: 0.7rem; font-weight: 800; }
.upload-form { display: grid; gap: 18px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.publish-toggle { grid-template-columns: auto 1fr; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(188, 229, 127, 0.055); }
.publish-toggle input { width: 17px; height: 17px; accent-color: #b8e86b; }
.publish-toggle span { display: grid; gap: 2px; }
.publish-toggle small { line-height: 1.35; }
.upload-footer { display: flex; align-items: center; gap: 12px; }
.upload-footer .form-message { flex: 1; margin: 0; }

.release-list { display: grid; gap: 10px; max-height: 720px; overflow: auto; padding-right: 4px; }
.release-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(7, 14, 16, 0.36); }
.release-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.release-device { color: var(--sage); font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; }
.release-version { margin-top: 3px; font-family: Georgia, "Times New Roman", serif; font-size: 1.26rem; }
.release-state { border-radius: 999px; padding: 5px 8px; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.release-state.published { background: rgba(157, 232, 104, 0.14); border: 1px solid rgba(157, 232, 104, 0.34); color: #cafa9e; }
.release-state.draft { background: rgba(255, 188, 109, 0.12); border: 1px solid rgba(255, 188, 109, 0.34); color: #ffd1a0; }
.release-file { margin: 12px 0 7px; color: #d8ded4; font-size: 0.82rem; word-break: break-word; }
.release-notes { color: var(--muted); font-size: 0.84rem; line-height: 1.46; white-space: pre-wrap; }
.release-meta { display: grid; grid-template-columns: 0.64fr 1.36fr; gap: 10px; margin: 15px 0; padding-top: 12px; border-top: 1px solid var(--line); }
.release-meta div { min-width: 0; }
.release-meta dt { color: var(--muted); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.release-meta dd { margin: 4px 0 0; overflow: hidden; color: #ecede5; font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.release-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.download-link { align-self: center; color: #d6f28e; font-size: 0.8rem; font-weight: 800; text-decoration: none; }
.download-link:hover { text-decoration: underline; }
.empty-state { padding: 28px 10px; color: var(--muted); text-align: center; line-height: 1.45; }

@media (max-width: 800px) {
  .shell { width: min(100% - 24px, 620px); padding-top: 22px; }
  .masthead { margin-bottom: 20px; }
  .login-panel, .overview-grid, .workspace-grid { grid-template-columns: 1fr; }
  .login-panel { gap: 24px; }
  .overview-grid { margin-bottom: 12px; }
  .upload-panel, .release-panel, .overview-card { padding: 17px; border-radius: 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .release-list { max-height: none; }
}

@media (max-width: 430px) {
  .shell { width: min(100% - 18px, 620px); }
  .masthead { gap: 10px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 12px; }
  .upload-footer { align-items: stretch; flex-direction: column; }
  .upload-footer .primary-button { width: 100%; }
  .release-meta { grid-template-columns: 1fr; }
  .release-actions .secondary-button, .release-actions .danger-button { flex: 1; }
}
