:root { font-family: Inter, ui-sans-serif, system-ui, sans-serif; color: #17211c; background: #f3f1eb; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #fff 0, transparent 35%), #f3f1eb; }
main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 80px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: Georgia, serif; font-weight: 500; letter-spacing: -.035em; font-size: clamp(2rem, 5vw, 3.5rem); margin-bottom: 12px; }
h2 { font-family: Georgia, serif; font-weight: 500; margin-bottom: 0; }
.eyebrow { color: #8d6139; text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 800; margin-bottom: 7px; }
.muted { color: #66716b; line-height: 1.55; }
.mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; color: white; background: #173f34; font: 600 1.15rem Georgia, serif; margin-bottom: 28px; box-shadow: 0 12px 32px #173f3433; }
.login-card { width: min(440px, 100%); margin: 9vh auto 0; padding: 38px; background: #fffefa; border: 1px solid #dedbd1; border-radius: 24px; box-shadow: 0 30px 80px #26352d18; }
form { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 7px; font-size: .82rem; font-weight: 750; color: #445049; }
input, textarea, select { width: 100%; border: 1px solid #cfd3cd; border-radius: 11px; padding: 12px 14px; background: white; color: inherit; font: inherit; outline: none; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: #397660; box-shadow: 0 0 0 3px #3976601f; }
button { border: 0; border-radius: 11px; padding: 12px 17px; background: #173f34; color: white; font: 750 .86rem inherit; cursor: pointer; }
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: wait; }
button.secondary { background: #e6ebe7; color: #264237; }
button.danger { background: #9d3d37; }
.error { min-height: 20px; color: #a13530; margin: 8px 0 0; font-size: .86rem; }
header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 28px; border-bottom: 1px solid #d5d5cc; }
header h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0; }
.header-actions { display: flex; align-items: center; gap: 14px; color: #5f6a64; font-size: .85rem; }
nav { display: flex; gap: 8px; padding: 22px 0; }
.tab { background: transparent; color: #657069; }
.tab.active { background: #173f34; color: white; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 13px; }
.metric, .notice { background: #fffefa; border: 1px solid #dedbd1; border-radius: 17px; padding: 20px; }
.metric strong { display: block; font: 500 2rem Georgia, serif; color: #173f34; }
.metric span { color: #67716c; font-size: .8rem; }
.notice { margin-top: 18px; border-left: 4px solid #ba895c; }
.notice p { color: #68736c; margin: 7px 0 0; }
.toolbar { display: flex; gap: 10px; margin-bottom: 15px; }
.toolbar input { max-width: 430px; }
.table-wrap { overflow: auto; background: #fffefa; border: 1px solid #dedbd1; border-radius: 17px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e7e5dd; text-align: left; font-size: .84rem; }
th { color: #788078; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 9px; background: #e5efe9; color: #276046; font-size: .72rem; font-weight: 800; }
.badge.warn { background: #f6e6df; color: #8d3a32; }
.link-button { background: transparent; color: #27604d; padding: 7px; }
dialog { width: min(680px, calc(100% - 28px)); border: 0; border-radius: 21px; padding: 28px; color: #17211c; box-shadow: 0 30px 100px #13231b55; }
dialog::backdrop { background: #13231b99; backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.icon { background: #edf0ed; color: #33453c; font-size: 1.4rem; padding: 7px 12px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 28px; }
.device-list { display: grid; gap: 10px; }
.device { border: 1px solid #dedbd1; border-radius: 13px; padding: 14px; display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.device p { margin: 3px 0 0; color: #6d766f; font-size: .78rem; }
.versions-list { display: grid; gap: 12px; margin-top: 18px; }
.version-card { margin: 0; border-left-color: #d5d5cc; }
.version-card:has(.badge) { border-left-color: #397660; }
.version-card > div { display: flex; align-items: center; gap: 10px; }
.version-card small { display: block; margin-top: 5px; color: #66716b; }
.version-card pre { margin: 14px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: .84rem; line-height: 1.55; }
.toolbar { justify-content: space-between; align-items: center; }
.toolbar-actions, .heading-line, .node-actions, .order-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.drafting-layout { display: grid; grid-template-columns: 255px minmax(0, 1fr); min-height: 610px; border: 1px solid #dedbd1; border-radius: 19px; overflow: hidden; background: #fffefa; }
.template-sidebar { padding: 12px; border-right: 1px solid #e1dfd7; background: #f8f6f0; }
.template-list { display: grid; gap: 7px; }
.template-card { width: 100%; padding: 12px; border: 1px solid transparent; background: transparent; color: #24372e; text-align: left; }
.template-card:hover, .template-card.active { filter: none; border-color: #d2d8d2; background: white; }
.template-card.active { box-shadow: inset 3px 0 #397660; }
.template-card strong, .template-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-card small { margin-top: 4px; color: #6b756f; font-weight: 500; }
.template-card .card-meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 9px; font-size: .68rem; color: #7b827d; }
.template-card .badge { padding: 3px 6px; font-size: .62rem; }
.editor-placeholder { display: grid; align-content: center; justify-items: center; min-height: 260px; padding: 30px; color: #66716b; text-align: center; }
.editor-placeholder p { margin: 6px 0 0; }
.template-workspace { min-width: 0; padding: 22px; }
.template-heading { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #e4e2da; }
.template-heading h2 { margin: 0; }
.template-heading .muted { margin: 7px 0 0; font-size: .78rem; }
.dirty { border-radius: 999px; padding: 5px 9px; background: #fff0cc; color: #8b5a16; font-size: .7rem; font-weight: 800; }
.template-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 20px 0; }
.template-fields .wide { grid-column: 1 / -1; }
.structure-editor { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(330px, 1.15fr); gap: 15px; }
.tree-panel, .property-panel { min-width: 0; min-height: 420px; padding: 16px; border: 1px solid #e1dfd7; border-radius: 15px; background: #fbfaf6; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h3 { margin: 0; }
.template-tree { display: grid; gap: 4px; max-height: 520px; overflow: auto; }
.tree-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid transparent; background: transparent; color: #33463d; text-align: left; }
.tree-item:hover, .tree-item.selected { filter: none; background: white; border-color: #d5d9d4; }
.tree-item.selected { color: #173f34; box-shadow: inset 3px 0 #397660; }
.tree-symbol { flex: none; width: 21px; color: #8d6139; text-align: center; }
.tree-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-actions { margin: 4px 0 18px; }
#node-form { margin: 0; }
#node-form label + label, #clause-fields label + label { margin-top: 14px; }
#clause-fields { margin-top: 14px; }
.optional, .field-help { color: #7b837e; font-size: .72rem; font-weight: 500; }
.field-help { margin: 7px 0 0; line-height: 1.45; }
.order-actions { margin-top: 18px; padding-top: 15px; border-top: 1px solid #e4e2da; }
.published-history { display: flex; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: #f2f4f0; font-size: .78rem; }
#template-dialog form { margin: 0; }
@media (max-width: 900px) { .drafting-layout { grid-template-columns: 1fr; } .template-sidebar { border-right: 0; border-bottom: 1px solid #e1dfd7; } .template-list { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } .structure-editor { grid-template-columns: 1fr; } .template-heading { flex-direction: column; } }
@media (max-width: 640px) { main { width: min(100% - 20px, 1180px); padding-top: 20px; } .login-card { padding: 25px; } header { align-items: flex-start; } .header-actions { flex-direction: column; align-items: flex-end; } nav { overflow-x: auto; } .drafting-toolbar { align-items: flex-start; } .template-fields { grid-template-columns: 1fr; } .template-fields .wide { grid-column: auto; } .template-workspace { padding: 14px; } }
