:root {
  --primary: #1f6f63;
  --secondary: #f0a73a;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #6e7781;
  --line: #d9dee5;
  --danger: #b3261e;
  --ok: #1d7f46;
  --warn: #b36b00;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; background: var(--panel); border-bottom: 4px solid var(--primary); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 5; }
.brand-block { display: flex; align-items: center; gap: 16px; }
.logo-placeholder { width: 58px; height: 58px; border-radius: 14px; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; letter-spacing: 1px; }
h1 { margin: 0; font-size: 24px; }
#projectSubtitle { margin: 4px 0 0; color: var(--muted); }
.identity-block { min-width: 330px; }
.identity-block label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 4px; }
.identity-row { display: flex; gap: 8px; }
.identity-row select, .identity-row input { flex: 1; }
.identity-status { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
main { padding: 28px; }
.view { display: none; }
.view.active { display: block; }
.hero-card, .panel { background: var(--panel); padding: 26px; border-radius: 18px; box-shadow: var(--shadow); max-width: 980px; margin: 24px auto; }
.panel.wide { max-width: 1180px; }
.action-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
button, .file-button { border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button.primary, .file-button.primary { background: var(--primary); color: white; }
button.secondary, .file-button.secondary { background: #edf1f4; color: var(--text); }
button.danger { background: var(--danger); color: white; }
button.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
button:disabled { opacity: .45; cursor: not-allowed; }
.file-button input { display: none; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { font-weight: 700; font-size: 13px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 6px; font-family: inherit; font-size: 14px; background: #fff; }
textarea { min-height: 80px; resize: vertical; }
.hint, .field-hint { color: var(--muted); font-style: italic; font-size: 12px; line-height: 1.35; margin: 4px 0 10px; font-weight: 400; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { background: #e8edf1; color: var(--text); }
.tab.active { background: var(--primary); color: white; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric-card { background: var(--panel); padding: 20px; border-radius: 16px; box-shadow: var(--shadow); border-top: 5px solid var(--primary); }
.metric-card h3 { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.metric-card strong { font-size: 36px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toolbar-left, .toolbar-right { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.table-wrap { background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
th { background: #f1f4f6; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.badge { display: inline-block; padding: 4px 7px; border-radius: 999px; font-size: 12px; background: #edf1f4; color: var(--text); margin: 2px; }
.badge.ok { background: #e2f4e8; color: var(--ok); }
.badge.warn { background: #fff3d7; color: var(--warn); }
.badge.admin { background: var(--primary); color: white; }
.hidden { display: none !important; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 22px; z-index: 20; }
.modal-card { background: var(--panel); width: min(1080px, 96vw); max-height: 92vh; overflow: auto; border-radius: 18px; box-shadow: var(--shadow); padding: 24px; position: relative; }
.modal-close { position: sticky; top: 0; float: right; background: #edf1f4; border-radius: 50%; width: 34px; height: 34px; padding: 0; font-size: 20px; }
.section-box { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 14px 0; background: #fff; }
.section-box h3 { margin-top: 0; color: var(--primary); }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; margin: 10px 0; }
.check-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px; border: 1px solid #edf1f4; border-radius: 8px; background: #fafafa; }
.check-row input { width: auto; margin-top: 2px; }
.check-row label { font-weight: 400; margin: 0; }
.radio-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 12px; }
.radio-row label { font-weight: 400; }
.radio-row input { width: auto; margin-right: 4px; }
.owner-table input { max-width: 90px; }
.total-line { margin-top: 8px; font-weight: 700; }
.total-line.error { color: var(--danger); }
.total-line.ok { color: var(--ok); }
.small { font-size: 12px; color: var(--muted); }
@media (max-width: 780px) {
  .app-header { flex-direction: column; align-items: stretch; gap: 14px; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.online-project-list {
  margin: 1rem 0;
}
.panel.compact {
  padding: 1rem;
  margin-top: 1rem;
}
.optional-row td { background: #fff8e8; }
.optional-row .badge { background: #f6e2a8; color: #503b00; }
