/* ===== System on a phone · the section index and every section ===== */

/* a section's panel keeps its accent edge but gives its padding back to the rows inside it */
#tab-system .system-panel { padding: 0.75rem; margin-bottom: 0.75rem; border-radius: var(--radius-lg); }


/* ─── Index · every card carries a line of description, so one column reads rather than squeezes ─── */

/* the legacy phone rule set two columns here, so the shared one column is restated · 24 cards sit a touch tighter */
#tab-system .card-grid { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
#tab-system .card { min-height: 4rem; padding: 0.8rem 0.9rem; }
#tab-system .card-desc { font-size: 0.8rem; }
/* the index filter takes the bar's width once it's scrolled to */
#system-pathbar .pathbar-input { min-width: 12rem; min-height: 2.5rem; }


/* ─── List tables · lead card rows (workspace.css), the name on top and its facts wrapped under it ─── */

/* the row's first cell names it, so it leads on its own line */
#tab-system :where(#codes-tbody, #sysconfig-tbody, #response-categories-tbody, #machine-conditions-tbody, #lib-machines-tbody,
  #materials-tbody, #customers-tbody, #regions-tbody, #tools-tbody, #routes-tbody,
  #hosts-tbody, #daemons-tbody, #subnets-tbody, #shares-tbody, #process-alerts-tbody, #process-log-tbody) > tr > td:first-child,
#departments-tbody > tr > td:nth-child(3),
#stations-tbody > tr > td:nth-child(3) {
  order: 1;
  flex: 1 1 60%;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
/* a code is only a number, so the name it maps to leads beside it */
#codes-tbody > tr > td:nth-child(2),
#sysconfig-tbody > tr > td:nth-child(2) { order: 2; flex: 1 1 50%; font-size: 0.9rem; font-weight: 600; color: var(--text); }
#codes-tbody > tr > td:first-child,
#sysconfig-tbody > tr > td:first-child { flex: none; font-family: ui-monospace, 'Cascadia Code', monospace; }
/* a constant's value is what you came to read, so it takes a line of its own */
#sysconfig-tbody > tr > td:nth-child(3) { order: 5; flex: 1 1 100%; font-family: ui-monospace, 'Cascadia Code', monospace; color: var(--text); overflow-wrap: anywhere; }
/* a bare order number needs its name back once the column header is gone */
#departments-tbody > tr > td:nth-child(2)::before,
#stations-tbody > tr > td:nth-child(2)::before { content: "#"; }
#departments-tbody > tr > td:nth-child(5)::before { content: "· Floor "; color: var(--text-faint); }
/* descriptions and long paths wrap under the facts rather than beside them */
#machine-conditions-tbody > tr > td:nth-child(2),
#tools-tbody > tr > td:nth-child(2),
#routes-tbody > tr > td:nth-child(2),
#departments-tbody > tr > td:nth-child(4),
#hosts-tbody > tr > td:nth-child(3),
#daemons-tbody > tr > td:nth-child(2),
#shares-tbody > tr > td:nth-child(3),
#subnets-tbody > tr > td:nth-child(3),
#sysconfig-tbody > tr > td:nth-child(4) { order: 5; flex: 1 1 100%; }
#shares-tbody > tr > td:first-child { overflow-wrap: anywhere; }
/* dates ride the end of the facts line */
#tab-system :where(#codes-tbody, #sysconfig-tbody, #materials-tbody, #tools-tbody, #departments-tbody, #routes-tbody, #process-log-tbody) > tr > td.col-date { margin-left: auto; font-size: 0.75rem; color: var(--text-faint); }
/* the active badge rides the lead line, where a glance finds it */
#tab-system .system-panel tbody > tr > td:has(> .badge) { order: 2; margin-left: auto; }
/* the sections that aren't cards (standards, nodes) get the same thumb-sized row actions, and no drag handle touch can't use */
#tab-system .system-panel td.col-action button { min-width: var(--touch); min-height: var(--touch); }
#tab-system td.col-drag { display: none; }


/* ─── Filters and forms · the search takes the line, every field and button thumb-sized ─── */
#tab-system .filter-row { flex-wrap: wrap; gap: 0.5rem; }
#tab-system .filter-row input[type="text"] { flex: 1 1 100%; min-width: 0; min-height: var(--touch); }
#tab-system .filter-row select { flex: 1 1 calc(50% - 0.25rem); min-width: 0; min-height: var(--touch); }
#tab-system .filter-row button { min-height: var(--touch); }
#tab-system .tab-btn { min-height: var(--touch); }
#tab-system .tab-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
#tab-system .tab-bar::-webkit-scrollbar { display: none; }
#tab-system .tab-bar .tab-btn { flex: none; }


/* ─── Logs · the time, level and source share one line, the message takes the next ─── */
#sys-logs .sys-logs-dt-group { flex: 1 1 100%; flex-wrap: wrap; }
#sys-logs .sys-logs-dt-group input { flex: 1 1 40%; min-width: 0; min-height: var(--touch); }
#sys-logs .filter-row label { display: inline-flex; align-items: center; gap: 0.35rem; min-height: var(--touch); }
.sys-log-line { flex-wrap: wrap; gap: 0.15rem 0.6rem; padding: 0.5rem 0; }
.sys-log-src { width: auto; flex: 1 1 auto; min-width: 0; }
.sys-log-msg { flex: 1 1 100%; }
/* the terminal keeps a scroll of its own, only shorter than a desk's 560px */
.sys-log-terminal { height: min(60dvh, 28rem); }


/* ─── Server · the stat columns stack, the services and paths tables scroll inside their block ─── */
.srv-header { flex-wrap: wrap; gap: 0.35rem 0.75rem; }
.srv-refresh-btn { min-width: var(--touch); min-height: var(--touch); }
/* the columns already stack under 700px · each one's figures pair up two to a line instead of one */
.srv-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.35rem 0.75rem; }
/* the memory bar and its used-of-total figure are too wide for half a line */
.srv-mem-bar-row,
.srv-mem-bar-row + .srv-row { grid-column: 1 / -1; }
.srv-services { overflow-x: auto; overscroll-behavior-x: contain; }


/* ─── Daemon console · its modal's rows wrap, the store grid goes two-up, every button thumb-sized ─── */
.dcon-meta-row,
.dcon-danger-zone { flex-wrap: wrap; }
.dcon-store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dcon-store-val { overflow-wrap: anywhere; }
.dcon-config-tabs { overflow-x: auto; scrollbar-width: none; }
.dcon-config-tab { flex: none; min-height: var(--touch); }
.dcon button { min-height: var(--touch); }


/* ─── Nodes and ERD · the drawing fills the width at a definite height and pans inside itself ─── */
#sys-sysmap .table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }
#sys-sysmap .data-table th,
#sys-sysmap .data-table td { min-width: 0; }
.erd-canvas-wrap { height: min(65dvh, 30rem); min-height: 0; overscroll-behavior: contain; }
/* the tables keep their desk layout inside the pan, so links still meet their boxes */
.erd-internal-area,
.erd-external-rail { padding: 0.75rem; }
.erd-legend { flex-wrap: wrap; gap: 0.35rem 0.75rem; }


/* ─── Standards · the scope drill and its tables scroll sideways inside the card ─── */
#sys-standards .table-scroll { overflow-x: auto; overscroll-behavior-x: contain; }


/* ─── Testing · one field per line, send across the card ─── */
#sys-testing .form-grid { grid-template-columns: minmax(0, 1fr); }
#sys-testing input,
#sys-testing select,
#sys-testing textarea { width: 100%; min-height: var(--touch); }
#sys-testing .btn-primary,
#sys-testing .btn-secondary { min-height: var(--touch); }
