@import url('./base.css');

html, body { height: 100%; }
body { font-size: 1.0625rem; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
kbd { font: 500 .9375rem/1 var(--font-mono); border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 8px; padding: .15rem .45rem; background: var(--surface); }
.btn.sm { min-height: 44px; padding: 0 1.1rem; font-size: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; font: 600 1.0625rem/1 var(--font-text); margin: 0; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); box-shadow: 8px 0 0 -3px var(--ink); margin-right: 8px; }

/* Giriş */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: min(440px, 100%); padding: 2rem; display: grid; gap: 1rem; }
.login-card h1 { font-size: 2.4rem; }
.lbl { font-weight: 600; }
.field { width: 100%; min-height: 56px; padding: 0 1rem; font-size: 1.5rem; letter-spacing: .12em; text-transform: uppercase; border-radius: var(--r); border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.field:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.err { color: var(--alert); font-weight: 600; margin: 0; }
.note { font-size: var(--step-small); color: var(--ink-2); }

/* Üst çubuk */
.panel { height: 100dvh; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 1rem; padding: .6rem clamp(.75rem, 2vw, 1.5rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: .25rem; margin-right: auto; }
.tab { min-height: 44px; padding: 0 1.1rem; border: 0; background: transparent; color: var(--ink-2); font: 600 1.0625rem/1 var(--font-text); border-radius: var(--r); cursor: pointer; display: inline-flex; align-items: center; gap: .5rem; }
.tab[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); }
.badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 1.6rem; padding: .15rem .5rem; font: 600 .9375rem/1.2 var(--font-text); text-align: center; }
.conn { display: inline-flex; align-items: center; gap: .5rem; font-size: var(--step-small); font-weight: 600; color: var(--ink-2); padding: 0 .9rem; min-height: 44px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--paper); }
.conn i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-control); }
.conn[data-s="live"] i { background: var(--accent); }
.conn[data-s="retry"] i { background: var(--warning); }
.conn[data-s="closed"] i { background: var(--ink-2); }

.urgent-bar { display: flex; align-items: center; gap: .75rem; padding: .6rem clamp(.75rem, 2vw, 1.5rem); background: var(--alert-soft); border-bottom: 2px solid var(--alert); color: var(--ink); font-weight: 600; animation: slide-in var(--t) var(--ease); }
.urgent-text { margin-right: auto; }
@keyframes slide-in { from { transform: translateY(-100%); opacity: 0; } to { transform: none; opacity: 1; } }

main { flex: 1; min-height: 0; display: flex; }
main:focus { outline: none; }
.inbox { flex: 1; display: grid; grid-template-columns: minmax(340px, 400px) 1fr; min-height: 0; width: 100%; }
.connect { flex: 1; overflow: auto; padding: clamp(1rem, 3vw, 2rem); }

/* Liste */
.list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--paper); }
.list-head { padding: 1rem 1rem .5rem; display: grid; gap: .6rem; }
.count { font-size: 1.0625rem; }
.count strong { font-size: 1.5rem; font-family: var(--font-display); font-weight: 500; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.list { list-style: none; margin: 0; padding: .5rem 1rem; overflow: auto; flex: 1; display: grid; gap: .5rem; align-content: start; }
.hint { padding: .35rem 1rem; font-size: var(--step-small); color: var(--ink-2); }
.kbd-hint { border-top: 1px solid var(--line); padding-top: .7rem; }
.hint:last-child { padding-bottom: .8rem; }

.row-item { position: relative; display: grid; gap: .3rem; width: 100%; text-align: left; min-height: 64px; padding: .8rem 1rem .8rem 1.15rem; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; font: inherit; color: inherit; }
.row-item:hover { border-color: var(--ink-2); }
.row-item[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }
.row-item.unread::before { content: ''; position: absolute; left: 7px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--accent); }
.row-item.unread .r-kind { font-weight: 700; }
.row-item.urgent { border-left: 5px solid var(--alert); background: var(--alert-soft); }
.row-item.urgent .r-kind { color: var(--alert); }
.row-item.urgent.unread::before { background: var(--alert); }
.r-top { display: flex; align-items: center; gap: .55rem; }
.r-kind { font-size: 1.0625rem; font-weight: 600; display: flex; align-items: center; gap: .45rem; }
.r-time { margin-left: auto; font-size: var(--step-small); color: var(--ink-2); white-space: nowrap; }
.r-sub { display: flex; gap: .6rem; align-items: baseline; font-size: var(--step-small); color: var(--ink-2); min-width: 0; }
.r-sub .mono { color: var(--ink); font-weight: 500; white-space: nowrap; flex: none; }
.r-sub span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row-item.enter { animation: item-in var(--t) var(--ease); }
@keyframes item-in { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
.mobile-empty { display: none; }
@media (max-width: 1000px) { .mobile-empty { display: block; } }
.empty-list { padding: 1rem; color: var(--ink-2); font-size: var(--step-small); }

/* Ayrıntı */
.detail-pane { overflow: auto; padding: clamp(1rem, 2.5vw, 2rem); min-width: 0; }
.detail-pane:focus { outline: none; }
.back { display: none; margin-bottom: 1rem; }
.d-card { padding: clamp(1.1rem, 2.5vw, 2rem); display: grid; gap: 1.4rem; max-width: 900px; }
.d-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.d-head h2 { font-size: 1.9rem; margin-right: auto; }
.d-meta { color: var(--ink-2); font-size: var(--step-small); display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; width: 100%; }
.d-meta .mono { color: var(--ink); font-weight: 500; font-size: 1.0625rem; }
.tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 .65rem; border-radius: 8px; background: var(--mist); font-size: var(--step-small); font-weight: 600; }
.tag.alert { background: var(--alert-soft); color: var(--alert); border: 1px solid var(--alert); }
.lines { display: grid; margin: 0; }
.line { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: .95rem 0; border-top: 1px solid var(--line); align-items: baseline; }
.line:first-child { border-top: 0; padding-top: 0; }
.line dt { font-weight: 700; color: var(--accent); font-size: 1.0625rem; }
.line dd { margin: 0; font-size: 1.3125rem; line-height: 1.4; }
.sec h3 { font-size: 1.15rem; font-family: var(--font-text); font-weight: 700; margin-bottom: .6rem; color: var(--ink-2); letter-spacing: 0; }
.sec ul { margin: 0; padding-left: 1.2rem; font-size: 1.1875rem; display: grid; gap: .35rem; }
.q { background: var(--mist); border-radius: var(--r); padding: 1rem 1.2rem; font-size: 1.25rem; }
.msg-text { font-size: 1.375rem; line-height: 1.45; }
.vals { width: 100%; border-collapse: collapse; font-size: 1.0625rem; }
.vals th { text-align: left; font-size: var(--step-small); color: var(--ink-2); font-weight: 600; padding: .4rem .6rem; border-bottom: 2px solid var(--line); }
.vals td { padding: .7rem .6rem; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.vals td.mono { font-size: 1.125rem; white-space: nowrap; }
.vals .name { font-family: var(--font-text); font-weight: 600; }
.vals .val { font-weight: 500; font-size: 1.25rem; }
.flag { display: inline-block; padding: .1rem .55rem; border-radius: 8px; font-size: var(--step-small); font-weight: 700; font-family: var(--font-text); background: var(--accent-soft); color: var(--ink); }
.flag.off { background: var(--mist); border: 1.5px solid var(--ink); }
.tbl-wrap { overflow-x: auto; }
.reply-box { display: grid; gap: .8rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.reply-box textarea { width: 100%; min-height: 96px; resize: vertical; padding: .8rem 1rem; font: 1.125rem/1.45 var(--font-text); border: 2px solid var(--line); border-radius: var(--r); color: var(--ink); background: var(--surface); }
.reply-box textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.reply-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.reply-foot { display: flex; align-items: center; gap: .8rem; }
.reply-foot .cnt { margin-right: auto; font-size: var(--step-small); color: var(--ink-2); }
.sent { background: var(--accent-soft); border-radius: var(--r); padding: .9rem 1.1rem; }
.sent small { display: block; color: var(--ink-2); font-size: var(--step-small); margin-top: .2rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.foot-note { font-size: var(--step-small); color: var(--ink-2); }

/* Boş / yükleniyor / hata */
.state { max-width: 560px; margin: clamp(1rem, 8vh, 5rem) auto; text-align: center; display: grid; gap: 1rem; justify-items: center; padding: 1rem; }
.state h2 { font-size: 1.9rem; }
.bigcode { font: 500 clamp(2.8rem, 8vw, 4.5rem)/1 var(--font-mono); letter-spacing: .14em; padding: 1rem 1.6rem; background: var(--surface); border: 2px dashed var(--ink-2); border-radius: var(--r); }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--mist); border-top-color: var(--accent); animation: sp 900ms linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Bağlantı sekmesi */
.c-grid { display: grid; gap: 1.5rem; max-width: 1100px; margin: 0 auto; }
.c-code { padding: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; }
.c-code .bigcode { border-style: solid; }
.c-addrs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.c-addr { padding: 1.25rem; display: grid; gap: .8rem; justify-items: start; }
.c-addr h3 { font-size: 1.3rem; }
.c-addr .url { font: 500 1rem/1.4 var(--font-mono); word-break: break-all; }
.qr { width: 200px; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 8px; display: grid; place-items: center; }
.qr img { width: 100%; height: 100%; }
.c-health { padding: 1.25rem 1.5rem; display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; align-items: center; }
.dlg { padding: 1.5rem; max-width: 420px; border: 1px solid var(--line); color: var(--ink); }
.dlg::backdrop { background: var(--backdrop); }
.dlg form { display: grid; gap: 1rem; }
.row { display: flex; gap: .6rem; justify-content: flex-end; }

/* Telefon / tablet: liste → ayrıntı */
@media (max-width: 1000px) {
  .inbox { grid-template-columns: 1fr; }
  .detail-pane { display: none; }
  .inbox.show-detail .list-pane { display: none; }
  .inbox.show-detail .detail-pane { display: block; }
  .back { display: inline-flex; }
  .list-pane { border-right: 0; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: .5rem; }
  .brand-text { display: none; }
  .tabs { order: 3; width: 100%; margin: 0; }
  .tab { flex: 1; justify-content: center; }
  .conn { margin-left: auto; }
  .line { grid-template-columns: 1fr; gap: .2rem; }
  .line dd { font-size: 1.25rem; }
  .urgent-bar { flex-wrap: wrap; }
  .kbd-hint { display: none; }
  .vals thead { display: none; }
  .vals, .vals tbody { display: block; }
  .vals tr { display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; padding: .8rem 0; border-bottom: 1px solid var(--line); align-items: center; }
  .vals td { border: 0; padding: 0; }
  .vals td.name { grid-column: 1 / -1; }
  .vals td:nth-child(3)::before { content: 'Referans: '; font-family: var(--font-text); color: var(--ink-2); font-size: var(--step-small); }
  .vals td:nth-child(3) { grid-column: 1 / -1; color: var(--ink-2); }
  .vals td:nth-child(4) { grid-row: 2; grid-column: 2; }
}
@media (hover: none) { .kbd-hint { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .row-item.enter, .urgent-bar { animation: fade var(--t) linear; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}

/* Yazdırma: yalnız seçili kart */
@media print {
  body { background: #fff; }
  .top, .list-pane, .urgent-bar, .actions, .reply-box, .back, .skip { display: none !important; }
  .panel, main, .inbox { display: block; height: auto; }
  .detail-pane { display: block !important; overflow: visible; padding: 0; }
  .d-card { box-shadow: none; border: 0; max-width: none; padding: 0; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
