:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #17213b;
  --muted: #75829a;
  --line: #e3e7f0;
  --violet: #705cf1;
  --violet-soft: #f0eeff;
  --mint: #1ca681;
  --mint-soft: #e5f7f1;
  --coral: #d66168;
  --shadow: 0 16px 45px rgba(37, 47, 83, .1);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 50% -12%, #fff 0, #f7f8fc 52%, #f0f3f8 100%); font: 15px/1.5 "IBM Plex Sans Thai", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { opacity: .44; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(112, 92, 241, .2); outline-offset: 2px; }
svg { width: 19px; height: 19px; stroke-width: 1.9; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(100%, 360px); display: grid; gap: 13px; padding: 28px 24px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.login-mark { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 4px; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #806cf4, #5947da); box-shadow: 0 10px 24px rgba(76,58,187,.25); font-size: 24px; font-weight: 700; }
.login-card h1 { margin: 0 0 3px; text-align: center; font-size: 24px; }
.login-card .field { margin: 0; }
.login-card .primary-button { width: 100%; margin-top: 4px; }

.app { width: min(100%, 1060px); min-height: 100vh; margin: 0 auto; background: rgba(255,255,255,.78); box-shadow: var(--shadow); overflow: hidden; }
.app-bar { min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); }
.app-title { color: var(--muted); font-size: 13px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: #fff; }
.icon-button:hover { background: #f7f7fd; color: var(--violet); }
.workspace { min-height: calc(100vh - 56px); padding: 22px 14px calc(34px + env(safe-area-inset-bottom)); }

.sync-state { min-height: 520px; display: grid; align-content: center; justify-items: center; text-align: center; }
.sync-orb, .kim-orb { position: relative; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(from 20deg, #e7e2ff, #d9e5ff, #ddfaf2, #e8ddff); box-shadow: 0 0 40px rgba(105,85,219,.18); overflow: hidden; }
.sync-orb { width: 152px; height: 152px; }
.sync-orb::before, .kim-orb::before { content: ""; position: absolute; inset: -65%; background: conic-gradient(from 150deg, transparent 34%, rgba(255,255,255,.95) 52%, rgba(126,154,255,.66) 68%, transparent 84%); animation: orbit-spin 1.8s linear infinite; }
.sync-orb::after, .kim-orb::after { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(255,255,255,.96); border-radius: 50%; background: rgba(255,255,255,.38); }
.sync-core { z-index: 1; width: 78px; height: 78px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #7662ca; box-shadow: 0 0 27px rgba(89,69,167,.43); }
.sync-state h1 { margin: 24px 0 5px; font-size: 22px; }
.sync-state p { margin: 0; color: var(--muted); }

.kim-profile { display: grid; justify-items: center; padding: 12px 0 19px; text-align: center; }
.kim-orb { width: 128px; height: 128px; margin-bottom: 15px; }
.kim-orb > img, .kim-orb > span { z-index: 1; width: 86px; height: 86px; display: grid; place-items: center; border-radius: 50%; object-fit: cover; color: #fff; background: linear-gradient(145deg, #806cf4, #5947da); box-shadow: 0 8px 20px rgba(65,51,171,.24); font-size: 34px; font-weight: 700; }
.kim-profile h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.kim-profile p { display: flex; align-items: center; gap: 7px; margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: #21bf82; box-shadow: 0 0 0 4px #e2f9ee; }

.main-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: #eef1f6; }
.main-tabs button { min-height: 43px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-weight: 700; }
.main-tabs button.active { color: var(--violet); background: #fff; box-shadow: 0 2px 5px rgba(27,38,71,.08); }

.group-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding-top: 20px; }
.group-card { min-width: 0; min-height: 221px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 9px 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.92); text-align: center; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.group-card:hover { transform: translateY(-2px); border-color: #cbc2fb; box-shadow: 0 14px 30px rgba(55,57,100,.09); }
.group-card.disabled { background: #fbfcfe; }
.group-logo-button { display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.group-orb { width: 82px; height: 82px; position: relative; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(from 20deg, #eeeaff, #dce8ff, #e4f8f2, #ded8ff); box-shadow: 0 0 22px rgba(107,90,218,.16); transition: transform .18s ease, box-shadow .18s ease; }
.group-logo-button:hover .group-orb { transform: scale(1.04); box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--violet), 0 0 28px rgba(107,90,218,.24); }
.group-orb::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(255,255,255,.95); border-radius: 50%; }
.group-logo { z-index: 1; width: 59px; height: 59px; display: grid; place-items: center; border-radius: 50%; overflow: hidden; color: var(--ink); background: #edf0f5; font-size: 20px; font-weight: 700; }
.group-logo img { width: 100%; height: 100%; object-fit: cover; }
.group-card.disabled .group-orb { filter: grayscale(.9); opacity: .6; }
.group-card h2 { width: 100%; margin: 12px 0 3px; overflow: hidden; font-size: 14px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.category { max-width: 100%; margin: 0; overflow: hidden; color: var(--violet); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.group-status { display: grid; gap: 3px; margin-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.3; }
.group-status span { display: flex; align-items: center; justify-content: center; gap: 4px; }
.group-status .active { color: var(--mint); font-weight: 700; }
.group-status .active::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.group-status .off { color: var(--muted); }
.empty-state { padding: 56px 18px; color: var(--muted); text-align: center; }
.empty-state svg { width: 38px; height: 38px; margin: 0 auto 13px; }
.empty-state strong { display: block; color: var(--ink); }
.empty-state p { max-width: 330px; margin: 4px auto 0; font-size: 13px; }

.global-view { display: grid; gap: 13px; padding-top: 20px; }
.settings-card { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.settings-card-head { display: flex; align-items: flex-start; gap: 12px; }
.settings-card-head > div { min-width: 0; flex: 1; }
.setting-symbol { width: 39px; height: 39px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: var(--violet); background: var(--violet-soft); }
.setting-symbol.mint { color: var(--mint); background: var(--mint-soft); }
.runtime-avatar { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border: 3px solid #e9e5ff; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #806cf4, #5947da); font-size: 16px; font-weight: 700; }
.runtime-avatar img { width: 100%; height: 100%; object-fit: cover; }
.runtime-status-chip { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: #6f788b; background: #eef1f5; font-size: 10px; font-weight: 700; white-space: nowrap; }
.runtime-status-chip.connected { color: #16775e; background: #e2f7f0; }
.runtime-status-chip.degraded { color: #99671d; background: #fff2d5; }
.runtime-status-chip.disconnected { color: #a84050; background: #ffe8ec; }
#runtime-status-message { margin-top: 14px; color: var(--ink); font-weight: 600; }
#runtime-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 12px; }
#runtime-details span { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; }
#runtime-details small, #runtime-details strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#runtime-details small { color: var(--muted); font-size: 9px; font-weight: 600; }
#runtime-details strong { margin-top: 2px; color: var(--ink); font-size: 11px; }
#runtime-storage-summary, #runtime-policy-summary { margin-top: 12px; }
#runtime-storage-summary .ready { color: #138a68; }
#runtime-storage-summary .failed { color: var(--danger); }
#line-runtime-card .secondary-button { margin-top: 13px; }
.settings-card h2 { margin: 0; font-size: 16px; }
.settings-card p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.password-form { display: grid; gap: 0; padding-top: 4px; }
.password-form .field { margin-top: 12px; }
.password-form .secondary-button { justify-self: start; margin-top: 16px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 0; }
.setting-row strong, .setting-row small { display: block; }
.setting-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }
code { color: #6651d6; font: 11px "IBM Plex Mono", monospace; }
.switch { position: relative; flex: 0 0 auto; width: 48px; height: 29px; padding: 0; border: 0; border-radius: 999px; background: #cbd3df; transition: background .18s ease; }
.switch span { position: absolute; top: 4px; left: 4px; width: 21px; height: 21px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: transform .18s ease; }
.switch[aria-checked="true"] { background: var(--violet); }
.switch[aria-checked="true"] span { transform: translateX(19px); }
.inline-info { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.inline-info:hover { color: var(--violet); }
.inline-info svg { width: 15px; height: 15px; }
.info-popover { position: relative; margin-top: 10px; padding: 11px 12px; border: 1px solid #dcd5ff; border-radius: 11px; color: #625f78; background: #f8f7ff; font-size: 12px; line-height: 1.55; }
.info-popover::before { content: ""; position: absolute; top: -6px; left: 16px; width: 10px; height: 10px; border-top: 1px solid #dcd5ff; border-left: 1px solid #dcd5ff; background: #f8f7ff; transform: rotate(45deg); }
.secondary-button, .primary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 11px; font-weight: 700; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: #fff; }
.primary-button { border: 0; color: #fff; background: linear-gradient(112deg, #5641e4, #735ef1 55%, #35a39a); box-shadow: 0 8px 18px rgba(86,65,228,.19); }

.sheet-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(20,27,48,.52); backdrop-filter: blur(4px); }
.group-sheet { width: min(760px, 100%); height: min(760px, calc(100dvh - 32px)); display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; border: 1px solid rgba(255,255,255,.5); border-radius: 18px; background: #fff; box-shadow: 0 24px 76px rgba(20,27,48,.3); }
.sheet-grip { display: none; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 15px 16px 12px; }
.sheet-group-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sheet-avatar { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border: 3px solid #eeeaff; border-radius: 50%; color: var(--violet); background: #f0eeff; font-weight: 700; }
.sheet-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sheet-head h2 { margin: 0; overflow: hidden; font-size: 18px; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.sheet-tabs { display: flex; gap: 3px; padding: 0 13px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.sheet-tabs::-webkit-scrollbar { display: none; }
.sheet-tabs button { flex: 0 0 auto; min-height: 39px; padding: 7px 11px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.sheet-tabs button.active { border-color: var(--violet); color: var(--violet); }
.sheet-body { min-height: 0; overflow-y: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet-panel { padding-top: 17px; }
.field { display: block; margin-top: 16px; }
.field > span, legend { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.field input, .field select, textarea { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #d4dbe7; border-radius: 10px; color: var(--ink); background: #fff; }
textarea { min-height: 138px; resize: vertical; line-height: 1.55; }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.code-row { display: grid; grid-template-columns: auto minmax(0,1fr) 30px; gap: 8px; align-items: center; margin-top: 15px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; }
.code-row > span { color: var(--muted); font-size: 11px; font-weight: 700; }
.code-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-row button { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; color: var(--violet); background: var(--violet-soft); }
.code-row svg { width: 15px; height: 15px; }
.session-binding { display: grid; grid-template-columns: 36px minmax(0, 1fr) 32px; gap: 10px; align-items: center; margin-top: 10px; padding: 11px; border: 1px solid #d9e9e4; border-radius: 11px; background: #f8fcfb; }
.session-binding.unbound { border-color: var(--line); background: #fafbfe; }
.session-binding-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--mint); background: var(--mint-soft); }
.session-binding.unbound .session-binding-icon { color: var(--muted); background: #eef1f5; }
.session-binding-icon svg { width: 18px; height: 18px; }
.session-binding-copy { min-width: 0; }
.session-binding-copy > span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.session-binding-copy b { padding: 2px 5px; border-radius: 5px; color: #16775e; background: #e2f7f0; font-size: 9px; }
.session-binding.unbound .session-binding-copy b { color: #6f788b; background: #eceff4; }
.session-binding-copy code, .session-binding-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-binding-copy code { margin-top: 3px; color: var(--ink); font-size: 11px; }
.session-binding-copy small { margin-top: 2px; color: var(--muted); font-size: 9px; }
#copy-session-id { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; color: var(--mint); background: #e2f7f0; }
#copy-session-id svg { width: 15px; height: 15px; }
fieldset { margin: 19px 0 0; padding: 0; border: 0; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-option { min-height: 76px; display: grid; grid-template-columns: 20px 1fr; gap: 2px 7px; align-content: center; padding: 9px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: #fff; text-align: left; }
.mode-option svg { grid-row: 1 / span 2; align-self: center; }
.mode-option strong, .mode-option small { display: block; }
.mode-option small { font-size: 10px; line-height: 1.3; }
.mode-option.selected { border-color: var(--violet); color: var(--violet); background: var(--violet-soft); }
.command-editor { min-height: 46px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 7px; border: 1px solid #d4dbe7; border-radius: 10px; }
.command-editor input { min-width: 100px; flex: 1; min-height: 28px; padding: 2px; border: 0; outline: 0; }
.command-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 7px; color: var(--violet); background: var(--violet-soft); font: 11px "IBM Plex Mono", monospace; }
.command-chip button { width: 16px; height: 16px; display: grid; place-items: center; padding: 0; border: 0; color: inherit; background: transparent; }
.command-chip svg { width: 12px; height: 12px; }
.sheet-actions { position: sticky; bottom: -24px; display: flex; justify-content: flex-end; margin: 24px -16px -24px; padding: 13px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.form-error { margin-top: 10px; color: var(--coral); font-size: 12px; }

.history-list, .document-list, .file-list, .member-list, .schedule-list { display: grid; gap: 9px; }
.history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.history-head h3 { margin: 0; font-size: 16px; }
.history-head small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.history-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.history-import-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.history-import-button:hover { color: var(--violet); border-color: #cfc8fb; }
.history-import-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.history-import-button svg, .history-undo-button svg { width: 15px; height: 15px; }
.history-undo-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 10px; border: 1px solid #f0ced3; border-radius: 9px; color: #a64050; background: #fff8f9; font-size: 11px; font-weight: 700; }
.history-undo-button:hover { border-color: #df9faa; background: #fff1f3; }
.history-undo-button:disabled { opacity: .5; cursor: wait; }
#history-import-form.loading { opacity: .5; pointer-events: none; }
.history-import-latest { margin: -5px 0 12px; color: var(--muted); font-size: 10px; }
.history-import-summary { margin: -4px 0 12px; padding: 8px 10px; border: 1px solid #d8d2fb; border-radius: 9px; color: #5e52b8; background: #f8f7ff; font-size: 11px; }
.history-entry { width: min(92%, 620px); display: flex; align-items: flex-end; gap: 7px; justify-self: start; }
.history-entry.owner-message { justify-self: end; justify-content: flex-end; }
.history-avatar { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border: 1px solid #e1e5ed; border-radius: 50%; color: #6651d6; background: #f0eeff; font-size: 11px; font-weight: 700; }
.history-entry.owner-message .history-avatar { color: #17351e; border-color: #59c968; background: #72df7d; }
.history-avatar img { width: 100%; height: 100%; object-fit: cover; }
.history-bubble { min-width: 0; max-width: calc(100% - 38px); padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: #fbfcfe; }
.history-entry.owner-message .history-bubble { border-color: #59c968; border-radius: 12px 12px 4px; color: #17351e; background: #72df7d; }
.history-media { display: block; margin: -3px -3px 9px; overflow: hidden; border-radius: 9px; background: #eef1f8; }
.history-media img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
.history-media-state { margin: -3px -3px 9px; padding: 12px; border-radius: 9px; color: #725717; background: #fff4cf; font-size: 10px; font-weight: 700; text-align: center; }
.history-media-state.failed { color: #a1424c; background: #fff0f1; }
.history-media-state.skipped { color: #667085; background: #eef1f5; }
.history-bubble p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 13px; }
.history-bubble small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 5px; color: var(--muted); font-size: 9px; }
.history-bubble small strong { color: inherit; }
.history-bubble small time { flex-basis: 100%; }
.history-entry.owner-message .history-bubble small { color: rgba(23,53,30,.72); }
.history-tag { padding: 2px 4px; border-radius: 5px; color: #5d50b7; background: #edeaff; font-size: 8px; font-weight: 700; }
.history-tag.pending { color: #8a6421; background: #fff2cd; }
.history-tag.quiet { color: #667085; background: #eceff4; }
.history-entry.ignored { opacity: .68; }
.section-intro h3 { margin: 0; font-size: 16px; }
.section-intro p { margin: 3px 0 14px; color: var(--muted); font-size: 12px; }
.notes-intro { margin-top: 26px; }
.document-item, .file-item, .member-item, .schedule-item { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.document-item > span, .file-preview, .member-picture { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border-radius: 10px; color: var(--violet); background: var(--violet-soft); }
.file-preview.image, .member-picture { border-radius: 50%; background: #eef1f5; }
.file-preview img, .member-picture img { width: 100%; height: 100%; object-fit: cover; }
.document-copy, .file-copy, .member-copy, .schedule-copy { min-width: 0; flex: 1; }
.document-copy strong, .file-copy strong, .member-copy strong, .schedule-copy strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.document-copy small, .file-copy small, .member-copy small, .schedule-copy small { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.document-actions, .file-actions { display: flex; gap: 4px; }
.small-button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; }
.small-button:hover { color: var(--violet); border-color: #cfc8fb; }
.small-button.danger:hover { color: var(--coral); border-color: #ffd5da; }
.small-button svg { width: 16px; height: 16px; }
.editor-form, .schedule-form { display: grid; gap: 9px; margin-top: 14px; padding: 13px; border: 1px dashed #cfc8fb; border-radius: 13px; background: #fbfaff; }
.editor-form input, .schedule-form input { min-height: 40px; padding: 8px 10px; border: 1px solid #d5dbea; border-radius: 9px; background: #fff; }
.editor-form textarea, .schedule-form textarea { min-height: 118px; }
.quota-row { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcff; }
.quota-row strong, .quota-row small { display: block; }
.quota-row small { color: var(--muted); font-size: 11px; }
.quota-track { height: 7px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: #e8ebf1; }
.quota-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--mint)); transition: width .2s ease; }
.file-tabs { display: flex; gap: 5px; margin-top: 14px; padding-bottom: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.file-tabs::-webkit-scrollbar { display: none; }
.file-tabs button { flex: 0 0 auto; min-height: 32px; padding: 5px 9px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 700; }
.file-tabs button.active { border-color: #d5cdfd; color: var(--violet); background: var(--violet-soft); }
.compact-intro { margin-top: 16px; }
.compact-intro p { margin-bottom: 10px; }
.upload-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 14px; }
.upload-picker { min-width: 0; min-height: 42px; display: flex; align-items: center; gap: 6px; padding: 8px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; font-size: 12px; }
.upload-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-picker span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-hint { margin: 8px 0 14px; color: var(--muted); font-size: 10px; }
.link-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr) auto; gap: 8px; margin-top: 14px; }
.link-form input { min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; }
.member-item { align-items: flex-start; }
.member-picture { width: 39px; height: 39px; color: var(--violet); font-size: 13px; font-weight: 700; }
.member-note { width: 100%; min-height: 58px; margin-top: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; }
.member-save { width: 100%; min-height: 30px; margin-top: 7px; border: 0; border-radius: 8px; color: var(--violet); background: var(--violet-soft); font-size: 11px; font-weight: 700; }
.schedule-item { align-items: flex-start; }
.schedule-item code { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schedule-item p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

.identity-form { margin-top: 18px; }
.identity-section { padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.identity-section + .identity-section { padding-top: 18px; }
.identity-section h3 { margin: 0; color: var(--ink); font-size: 14px; }
.identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.identity-form textarea { min-height: 112px; }
.identity-save { margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50; max-width: calc(100vw - 28px); padding: 10px 13px; border-radius: 11px; color: #fff; background: #1e2a47; box-shadow: 0 12px 28px rgba(20,27,48,.25); font-size: 12px; transform: translateX(-50%); }
@keyframes orbit-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
@media (min-width: 600px) { .app { min-height: calc(100vh - 30px); margin: 15px auto; border: 1px solid var(--line); border-radius: 18px; } .workspace { padding: 28px clamp(24px, 5vw, 54px) 42px; } .group-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; } .group-card { min-height: 238px; } .kim-orb { width: 142px; height: 142px; } .kim-orb > img, .kim-orb > span { width: 96px; height: 96px; } }
@media (max-width: 520px) { .group-sheet { height: calc(100dvh - 24px); } .history-entry { width: 100%; } .history-head { align-items: flex-start; } .link-form { grid-template-columns: 1fr; } .link-form .secondary-button { width: 100%; } .identity-grid { grid-template-columns: 1fr; } .identity-save { width: 100%; } }
@media (max-width: 390px) { .group-card { min-height: 205px; } .group-orb { width: 72px; height: 72px; } .group-logo { width: 52px; height: 52px; } .group-card h2 { font-size: 13px; } #runtime-details { grid-template-columns: 1fr; } .runtime-status-chip { padding-inline: 6px; } }
