:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172126;
  background: #f3f6f5;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #172126;
  --muted: #657177;
  --line: #dce4e2;
  --surface: #fff;
  --green: #2d6a58;
  --green-dark: #1d4a3d;
  --wash: #e8f1ed;
  --red: #9b3434;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #80b9a5; outline-offset: 2px; }
[hidden] { display: none !important; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 clamp(18px, 5vw, 76px); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); font-size: 19px; font-weight: 750; letter-spacing: -.04em; text-decoration: none; }
.account-area { display: flex; align-items: center; gap: 12px; }
.connection-state { color: var(--muted); font-size: 13px; }
.shell { width: min(980px, calc(100% - 36px)); margin: 38px auto 80px; }
.tabs { display: flex; align-items: center; gap: 5px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 13px 15px 12px; color: #627077; background: transparent; border: 0; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--green-dark); border-bottom-color: var(--green); font-weight: 650; }
.tab-count { display: inline-grid; min-width: 20px; height: 20px; place-items: center; padding: 0 5px; border-radius: 10px; color: var(--green-dark); background: var(--wash); font-size: 11px; }
.view { padding-top: 29px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 18px; }
h1 { margin: 0; color: var(--ink); font-size: 25px; font-weight: 650; letter-spacing: -.035em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 7px 24px rgba(36, 64, 55, .035); }
.compose-form { display: grid; grid-template-columns: 1fr; gap: 9px; padding: 24px; }
label { color: #35434a; font-size: 13px; font-weight: 620; }
input[type="text"], input[type="number"], textarea { width: 100%; border: 1px solid #ccd7d3; border-radius: 7px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; }
input:focus, textarea:focus { border-color: #639886; box-shadow: 0 0 0 3px rgba(99, 152, 134, .13); }
textarea { min-height: 220px; resize: vertical; line-height: 1.55; }
input::placeholder { color: #a0aaad; }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.button-row { display: flex; align-items: center; gap: 9px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 620; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button-dark { color: white; background: var(--green-dark); }
.button-dark:hover { background: #153b30; }
.button-light { color: #3f4b50; background: white; border-color: #d1dbd8; }
.button-light:hover { background: #f3f7f5; border-color: #afc4bb; }
.button-danger { color: var(--red); background: white; border-color: #e4caca; }
.button-danger:hover { background: #fff7f7; }
.notice { margin-top: 16px; padding: 12px 14px; border: 1px solid #d0e3da; border-radius: 8px; color: #235544; background: #edf7f2; font-size: 13px; }
.notice.error { color: #8e2f2f; border-color: #e8caca; background: #fff2f1; }
.message-list, .agent-list { display: grid; gap: 10px; }
.message-card, .agent-card { padding: 17px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.message-top, .agent-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.message-subject { margin: 0; font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.message-meta { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.message-actions { display: flex; align-items: center; gap: 7px; margin-top: 13px; flex-wrap: wrap; }
.message-body { margin-top: 12px; }
.message-body summary, .audit-details summary, .api-details summary { color: #47575d; font-size: 12px; font-weight: 620; cursor: pointer; }
.message-body pre { overflow: auto; padding: 12px; border-radius: 7px; background: #f5f7f6; color: #334147; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.status { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 8px; border-radius: 12px; color: #536168; background: #edf0ef; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status-pending_approval, .status-approved { color: #755b19; background: #f7f0d9; }
.status-sent { color: #236447; background: #e4f2e9; }
.status-failed, .status-uncertain { color: #973939; background: #fbe9e7; }
.empty-state { padding: 26px 0; color: var(--muted); text-align: center; font-size: 13px; }
.history-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.history-table { width: 100%; border-collapse: collapse; min-width: 640px; text-align: left; }
.history-table th, .history-table td { padding: 13px 15px; border-bottom: 1px solid #edf0ef; font-size: 12px; }
.history-table th { color: #67757a; background: #f8faf9; font-weight: 620; }
.history-table td { color: #334147; }
.history-table tbody tr:last-child td { border-bottom: 0; }
.history-table .subject-cell { max-width: 260px; font-weight: 620; overflow-wrap: anywhere; }
.audit-details, .api-details { margin-top: 18px; padding: 15px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.event-list { display: grid; gap: 9px; margin: 15px 0 0; padding-left: 19px; color: #56656b; font-size: 12px; }
.settings-card { padding: 5px 22px 19px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 22px; padding: 19px 0; border-bottom: 1px solid #edf0ef; cursor: pointer; }
.setting-row span { display: grid; gap: 5px; }
.setting-row strong { color: #27343a; font-size: 14px; font-weight: 620; }
.setting-row small { color: var(--muted); font-size: 12px; font-weight: 400; }
.setting-row input { width: 18px; height: 18px; accent-color: var(--green); }
.limit-setting { display: block; margin: 19px 0 8px; }
.limit-setting span { margin-left: 5px; color: var(--muted); font-weight: 400; }
#daily-limit { max-width: 150px; }
.agent-form { padding: 20px; }
.agent-form label { display: block; margin-bottom: 8px; }
.inline-form { display: flex; gap: 9px; }
.inline-form input { flex: 1; }
.agent-card small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.token-result { margin: 13px 0; padding: 16px; background: #edf7f2; border: 1px solid #cae1d5; border-radius: 9px; }
.token-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.token-value { display: block; margin-top: 11px; padding: 11px; border: 1px solid #d4e3dc; border-radius: 6px; background: white; overflow-wrap: anywhere; user-select: all; }
.token-result p { margin: 9px 0 0; color: #5f6d69; font-size: 12px; }
.api-details p { color: #59676c; font-size: 12px; line-height: 1.6; }
.api-details code { color: #34454b; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.api-details pre { padding: 12px; border-radius: 7px; background: #f5f7f6; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; line-height: 1.6; }
.signin-panel { display: grid; min-height: 62vh; place-items: center; }
.signin-card { display: grid; justify-items: start; gap: 18px; width: min(430px, 100%); padding: 30px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.signin-card p { margin: 0; color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .topbar { min-height: 60px; padding: 0 16px; }
  .account-area { gap: 8px; }
  .connection-state { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
  .button { min-height: 36px; padding: 0 11px; font-size: 12px; }
  .shell { width: min(100% - 26px, 980px); margin-top: 20px; }
  .tab { padding: 12px 10px 11px; font-size: 12px; }
  .view { padding-top: 23px; }
  h1 { font-size: 22px; }
  .compose-form { padding: 17px; }
  .form-footer { align-items: flex-start; flex-direction: column; }
  .form-footer .button-row { width: 100%; }
  .form-footer .button-row .button { flex: 1; }
  .message-top { flex-direction: column; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .limit-setting span { display: block; margin: 5px 0 0; }
  .signin-card { padding: 23px; }
}