:root {
  --bg: #f3f6f8;
  --card: #ffffff;
  --ink: #0d1b24;
  --sub: #65747f;
  --line: #e3e9ed;
  --green: #12b886;
  --green-2: #2fe3a2;
  --cyan: #3ec7ff;
  --navy: #07131d;
  --red: #d92d20;
  --amber: #b54708;
  --blue: #175cd3;
  --shadow: 0 16px 50px rgba(10, 30, 45, .09);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(47, 227, 162, .10), transparent 65%),
    radial-gradient(800px 500px at 100% 0%, rgba(62, 199, 255, .09), transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 12px; }
p { margin: 0 0 12px; }
code { background: #eef3f5; border-radius: 5px; padding: 1px 6px; font-size: .92em; }

.site-header {
  background: rgba(7, 19, 29, .97);
  color: #eaf5f1;
  border-bottom: 1px solid rgba(47, 227, 162, .16);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
}
.site-header .bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; letter-spacing: .5px; }
.logo svg { width: 34px; height: 34px; display: block; flex: none; }
.logo span { font-size: 18px; white-space: nowrap; line-height: 1; }
.logo .fp { color: var(--green-2); }
.site-header .spacer { flex: 1; }
.site-header .who { color: #9fb6c3; font-size: 13.5px; }
.site-header .who b { color: #eaf5f1; font-weight: 600; }
.nav-link {
  color: #d5e6e2;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  white-space: nowrap;
}
.nav-link:hover { text-decoration: none; border-color: var(--green-2); color: #fff; }
.nav-link.solid { background: linear-gradient(135deg, var(--green-2), var(--cyan)); color: #04121b; font-weight: 700; border: 0; }
.nav-link.danger { border-color: rgba(255, 120, 110, .4); color: #ffb4ad; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 26px 22px 60px; }
.wrap-narrow { max-width: 980px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; margin: 0; letter-spacing: .2px; }
.page-head .sub { color: var(--sub); font-size: 14px; }
.page-head .spacer { flex: 1; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.card-sub { color: var(--sub); font-size: 13.5px; margin-bottom: 18px; }
.card.tight { padding: 20px; }
.card.flat { box-shadow: none; }

.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.alert-success { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.alert-error { background: #fef3f2; border-color: #fecdca; color: #b42318; }
.alert-info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }
.alert-warn { background: #fffaeb; border-color: #fedf89; color: #b54708; }

/* Auth */
.auth-shell { display: grid; grid-template-columns: 1.05fr .95fr; gap: 22px; align-items: stretch; max-width: 1040px; margin: 40px auto 70px; }
.auth-brand {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background:
    radial-gradient(500px 260px at 10% 0%, rgba(47,227,162,.22), transparent 60%),
    radial-gradient(520px 300px at 100% 100%, rgba(62,199,255,.16), transparent 62%),
    linear-gradient(155deg, #07131d, #0b2430 70%, #0a1b2a);
  color: #e9f6f2;
  padding: 44px 40px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.auth-brand .logo { margin-bottom: 40px; }
.auth-brand .logo svg { width: 42px; height: 42px; }
.auth-brand .logo span { font-size: 24px; letter-spacing: .5px; }
.auth-brand h2 { font-size: 31px; letter-spacing: .3px; margin-bottom: 14px; }
.auth-brand h2 em { font-style: normal; color: var(--green-2); }
.auth-brand p { color: #a8c0ca; font-size: 14.5px; max-width: 430px; }
.auth-brand ul { margin: 22px 0 0; padding: 0; list-style: none; color: #c7dbe0; font-size: 14px; }
.auth-brand li { padding: 7px 0 7px 26px; position: relative; }
.auth-brand li::before { content: "✓"; position: absolute; left: 0; top: 7px; color: var(--green-2); font-weight: 800; }
.auth-foot { margin-top: auto; padding-top: 28px; font-size: 12.5px; color: #72919e; }
.auth-card { padding: 38px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-card h1 { font-size: 25px; margin-bottom: 6px; }
.auth-card .lead { color: var(--sub); font-size: 13.5px; margin-bottom: 22px; }
.auth-switch { margin-top: 18px; font-size: 13.5px; color: var(--sub); }
.auth-switch a { font-weight: 600; }
.admin-tip { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--sub); }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field label, .label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; color: #263944; }
.field label .req { color: var(--red); margin-left: 3px; }
.field .hint { color: var(--sub); font-size: 12.5px; margin-top: 6px; line-height: 1.55; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"], select, textarea {
  width: 100%;
  border: 1px solid #cfdbe2;
  background: #fbfdfe;
  border-radius: 9px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(18, 184, 134, .13);
}
input:disabled, textarea:disabled, select:disabled { background: #f1f4f6; color: #65747f; }
textarea { min-height: 96px; resize: vertical; }
.radio-row { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-card {
  flex: 1;
  min-width: 160px;
  border: 1px solid #cfdbe2;
  border-radius: 10px;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #fbfdfe;
  font-size: 14px;
}
.radio-card input { accent-color: var(--green); }
.radio-card.active { border-color: var(--green); background: #effaf6; box-shadow: 0 0 0 3px rgba(18,184,134,.08); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 18px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, filter .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.03); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--green-2), var(--green)); color: #04121b; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-outline { background: #fff; border-color: #cfdbe2; color: #263944; }
.btn-outline:hover { border-color: var(--green); color: #087a5b; }
.btn-danger { background: var(--red); color: #fff; }
.btn-warn { background: #f79009; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-actions { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.form-actions .note { color: var(--sub); font-size: 12.5px; margin-left: auto; }

/* Upload */
.upload-box {
  border: 1px dashed #bfd0d9;
  border-radius: 10px;
  background: #fafcfd;
  padding: 12px;
}
.upload-box input[type="file"] { width: 100%; font-size: 13.5px; }
.upload-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.upload-preview a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  width: 120px;
}
.upload-preview img { width: 100%; height: 80px; object-fit: cover; display: block; }
.upload-preview .pdf-chip { padding: 22px 10px; text-align: center; color: #b42318; font-size: 12px; }
.upload-preview .cap { font-size: 11.5px; color: var(--sub); padding: 5px 7px; word-break: break-all; }
.file-chip { display: inline-flex; align-items: center; gap: 7px; background: #eef7f4; border: 1px solid #cdeee2; color: #087a5b; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.file-chip a { color: inherit; }

/* Signature */
.sign-wrap { border: 1px solid #cfdbe2; border-radius: 10px; background: repeating-linear-gradient(0deg, #fff, #fff 28px, #f7fafb 28px, #f7fafb 29px); overflow: hidden; }
#signaturePad { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; }
.sign-tools { display: flex; gap: 10px; align-items: center; margin-top: 9px; flex-wrap: wrap; }
.sign-tools .hint { color: var(--sub); font-size: 12.5px; }
.sign-preview img { max-width: 260px; max-height: 100px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }

/* Status */
.status-pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-draft { background: #f2f4f7; border-color: #d0d5dd; color: #475467; }
.st-pending { background: #fffaeb; border-color: #fedf89; color: #b54708; }
.st-approved { background: #ecfdf3; border-color: #abefc6; color: #067647; }
.st-rejected { background: #fef3f2; border-color: #fecdca; color: #b42318; }

/* Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-grid-5 { grid-template-columns: repeat(5, 1fr); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat .k { color: var(--sub); font-size: 12.5px; }
.stat .v { font-size: 20px; font-weight: 700; margin-top: 5px; }
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-top: 18px; }
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--sub); }
.kv dd { margin: 0; word-break: break-word; }
.actions-col { display: flex; flex-direction: column; gap: 10px; }
.actions-col .btn { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
table.data th, table.data td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { background: #f7fafb; color: #475467; font-weight: 600; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #fbfdfe; }
.muted { color: var(--sub); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 150px; margin: 0; }
.filters .field.grow { flex: 1; min-width: 220px; }
.filters select, .filters input { padding: 9px 11px; font-size: 14px; }

/* Detail */
.detail-section + .detail-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.detail-section h3 { font-size: 16px; margin-bottom: 14px; }
.detail-kv { display: grid; grid-template-columns: 180px 1fr; gap: 9px 18px; font-size: 14px; }
.detail-kv dt { color: var(--sub); }
.detail-kv dd { margin: 0; word-break: break-word; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.doc-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.doc-card .img { display: block; height: 130px; background: #f5f8fa; }
.doc-card .img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.doc-card .pdf-box { height: 130px; display: flex; align-items: center; justify-content: center; color: #b42318; font-weight: 700; font-size: 13px; background: #fff8f7; }
.doc-card .cap { padding: 8px 10px; font-size: 12px; color: var(--sub); border-top: 1px solid var(--line); word-break: break-all; }
.order-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fcfdfe; }
.order-card .head { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.order-card .shots { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Agreement */
.agreement-doc { font-size: 13.5px; line-height: 1.85; color: #25323b; }
.agreement-doc h1 { font-size: 23px; text-align: center; margin: 4px 0 18px; letter-spacing: 2px; }
.agreement-doc h2 { font-size: 16px; margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.agreement-doc h3 { font-size: 14.5px; margin: 18px 0 8px; }
.agreement-doc p { margin: 0 0 9px; text-align: justify; }
.agreement-doc .ag-no { text-align: right; color: var(--sub); font-size: 12.5px; }
.agreement-doc .fill { border-bottom: 1px solid #9db0bb; padding: 0 4px; color: #087a5b; font-weight: 600; }
.ag-party-table { width: 100%; border-collapse: collapse; margin: 14px 0 18px; font-size: 13px; }
.ag-party-table th, .ag-party-table td { border: 1px solid #d5e0e6; padding: 7px 10px; text-align: left; vertical-align: top; }
.ag-party-table th { width: 34%; background: #f7fafb; font-weight: 600; color: #475467; }
.ag-party-table .ag-party-head { text-align: center; background: #eef7f4; color: #087a5b; font-weight: 700; }
.ag-price-table { width: 100%; border-collapse: collapse; margin: 10px 0 18px; font-size: 12.5px; }
.ag-price-table th, .ag-price-table td { border: 1px solid #d5e0e6; padding: 6px 9px; text-align: left; }
.ag-price-table thead th { background: #f7fafb; color: #475467; }
.ag-price-table .ag-price-section th { background: #eef7f4; color: #087a5b; }
.ag-notice { background: #f8fbfc; border: 1px solid var(--line); border-radius: 8px; padding: 12px 15px; margin: 10px 0 14px; }
.ag-notice p { margin: 0 0 4px; }
.ag-sign-page { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); }
.ag-sign-title { text-align: center; font-weight: 700; }
.ag-sign-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.ag-sign-table td { border: 1px solid #d5e0e6; padding: 18px 14px; width: 50%; color: #475467; }
.agreement-toolbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* Modal */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 14, 22, .62);
  display: none;
  z-index: 100;
  padding: 24px;
  overflow: auto;
}
.modal-mask.open { display: flex; align-items: flex-start; justify-content: center; }
.modal-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
  width: min(980px, 100%);
  margin: 10px auto 40px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 60px);
}
.modal-head { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 18px 26px 30px; overflow: auto; }
.modal-close { background: #f2f4f7; border: 0; border-radius: 8px; width: 34px; height: 34px; font-size: 20px; cursor: pointer; color: #475467; }
.agree-check { display: flex; gap: 10px; align-items: flex-start; background: #f8fbfc; border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; margin-top: 20px; font-size: 14px; }
.agree-check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--green); }
.agree-check label { cursor: pointer; }

/* Misc */
.empty { text-align: center; padding: 50px 20px; color: var(--sub); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .35; }
.icon-btn { border: 0; background: none; color: var(--green); cursor: pointer; font: inherit; padding: 0; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.badge-count { display: inline-block; background: #eef7f4; color: #087a5b; border: 1px solid #cdeee2; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.progress-note { display: flex; gap: 8px; align-items: center; color: var(--sub); font-size: 12.5px; }
.footer-note { text-align: center; color: #8a9aa4; font-size: 12.5px; padding: 26px 10px 0; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; margin: 20px auto 50px; }
  .auth-brand { padding: 30px 26px; }
  .auth-brand .logo { margin-bottom: 24px; }
  .auth-brand h1, .auth-brand h2 { font-size: 25px; }
  .auth-card { padding: 30px 26px; }
  .dash-grid { grid-template-columns: 1fr; }
  .stat-grid, .stat-grid-5 { grid-template-columns: 1fr; }
  .detail-kv { grid-template-columns: 130px 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .wrap { padding: 18px 14px 44px; }
  .card { padding: 18px 16px; border-radius: 12px; }
  .site-header .bar { padding: 10px 14px; gap: 10px; flex-wrap: wrap; }
  .logo svg { width: 27px; height: 27px; }
  .logo span { font-size: 15px; }
  .site-header .who { display: none; }
  .nav-link { padding: 6px 9px; font-size: 12.5px; }
  .page-head h1 { font-size: 21px; }
  .kv { grid-template-columns: 105px 1fr; }
  .detail-kv { grid-template-columns: 105px 1fr; }
  .order-card .shots { grid-template-columns: 1fr; }
  .modal-mask { padding: 0; }
  .modal-box { border-radius: 0; max-height: 100vh; margin: 0; min-height: 100vh; }
  .modal-body { padding: 16px 16px 30px; }
  .form-actions .note { margin-left: 0; width: 100%; }
}
@media print {
  body { background: #fff; }
  .site-header, .no-print, .footer-note { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
}
