mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 15:50:36 -05:00
- The top bar (and the phone's status bar) turns red when the server can't be reached: the device is offline, or a request failed (signal but no internet, or the proxy answering for the app). While red it checks /up every 15 seconds and turns back on its own. - A ring fills while pages are saved for offline use or flights and squawks logged offline are sent, with the percentage in its middle, and hides when done. While some wait to send, it's amber with how many. Checked on an Android 14 emulator: airplane mode on and off, saving for offline, and a flight logged offline then sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
224 lines
12 KiB
CSS
224 lines
12 KiB
CSS
@import "tailwindcss";
|
|
|
|
/* Semantic colors that differ by theme (dark values are set further down). */
|
|
@theme {
|
|
--color-page: oklch(96.8% 0.007 247.896); /* slate-100 */
|
|
--color-surface: oklch(100% 0 0); /* white: cards, inputs, menus */
|
|
--color-header: oklch(20.8% 0.042 265.755); /* slate-900: top bar, dark in both themes */
|
|
--color-header-offline: oklch(50.5% 0.213 27.518); /* red-700: top bar when the server can't be reached */
|
|
--color-accent: oklch(50% 0.134 242.749); /* sky-700: primary buttons */
|
|
--color-accent-hover: oklch(44.3% 0.11 240.79); /* sky-800 */
|
|
}
|
|
|
|
@utility btn { @apply inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium shadow-sm transition cursor-pointer disabled:opacity-50; }
|
|
@utility btn-primary { @apply btn bg-accent text-white hover:bg-accent-hover; }
|
|
@utility btn-secondary { @apply btn bg-surface text-slate-700 ring-1 ring-slate-300 ring-inset hover:bg-slate-50; }
|
|
@utility btn-danger { @apply btn bg-surface text-red-700 ring-1 ring-red-300 ring-inset hover:bg-red-50; }
|
|
@utility btn-sm { @apply px-2 py-1 text-xs; }
|
|
@utility link { @apply text-sky-700 hover:underline; }
|
|
/* The "More" menu (ApplicationHelper#more_menu): secondary actions, one per row. */
|
|
@utility menu { @apply absolute right-0 z-30 mt-2 w-60 rounded-md bg-surface py-1 shadow-lg ring-1 ring-slate-200; }
|
|
@utility menu-item { @apply block w-full px-4 py-2 text-left text-sm text-slate-700 hover:bg-slate-100 cursor-pointer; }
|
|
|
|
@utility card { @apply rounded-lg bg-surface shadow-sm ring-1 ring-slate-200; }
|
|
@utility card-header { @apply flex flex-wrap items-center justify-between gap-3 border-b border-slate-200 px-4 py-3; }
|
|
@utility card-title { @apply text-base font-semibold text-slate-900; }
|
|
@utility card-body { @apply p-4; }
|
|
|
|
@utility label { @apply block text-sm font-medium text-slate-700 mb-1; }
|
|
@utility input { @apply block w-full rounded-md border-0 px-2.5 py-1.5 text-sm text-slate-900 shadow-sm ring-1 ring-slate-300 ring-inset placeholder:text-slate-400 focus:ring-2 focus:ring-sky-600 focus:outline-none bg-surface; }
|
|
@utility hint { @apply mt-1 text-xs text-slate-500; }
|
|
@utility field-error { @apply mt-1 text-xs text-red-600; }
|
|
|
|
@utility table {
|
|
@apply min-w-full text-sm;
|
|
& th { @apply px-3 py-2 text-xs font-semibold uppercase tracking-wide text-slate-500 bg-slate-50; }
|
|
/* Left by default, but let text-right/text-center on a header win (numeric columns). */
|
|
& th:not(.text-right, .text-center) { text-align: left; }
|
|
& td { @apply px-3 py-2 align-top text-slate-700; }
|
|
& tbody tr { @apply border-t border-slate-100; }
|
|
& tbody tr:hover { @apply bg-slate-50; }
|
|
}
|
|
|
|
@utility badge { @apply inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ring-1 ring-inset whitespace-nowrap; }
|
|
@utility badge-red { @apply badge bg-red-50 text-red-700 ring-red-600/20; }
|
|
@utility badge-orange { @apply badge bg-amber-50 text-amber-800 ring-amber-600/30; }
|
|
@utility badge-green { @apply badge bg-emerald-50 text-emerald-700 ring-emerald-600/20; }
|
|
@utility badge-blue { @apply badge bg-sky-50 text-sky-700 ring-sky-600/20; }
|
|
@utility badge-gray { @apply badge bg-slate-100 text-slate-600 ring-slate-500/20; }
|
|
|
|
@utility tab { @apply whitespace-nowrap border-b-2 border-transparent px-3 py-2 text-sm font-medium text-slate-500 hover:border-slate-300 hover:text-slate-700; }
|
|
@utility tab-active { @apply border-sky-700 text-sky-700; }
|
|
|
|
/* ---------------------------------------------------------------------------
|
|
Dark theme: remap the palette instead of adding dark: variants everywhere.
|
|
Grays flip (light backgrounds become dark, dark text becomes light),
|
|
pale color tints become dim translucent ones, and dark colored text
|
|
(e.g. red-700) becomes its light counterpart. Set by the theme script in
|
|
the layout (<html data-theme="dark">).
|
|
------------------------------------------------------------------------- */
|
|
:root[data-theme="dark"] {
|
|
color-scheme: dark;
|
|
|
|
--color-page: oklch(15.5% 0.035 264);
|
|
--color-surface: oklch(20.8% 0.042 265.755);
|
|
--color-header: oklch(12.9% 0.042 264.695);
|
|
--color-header-offline: oklch(44.4% 0.177 26.899); /* red-800 */
|
|
--color-accent: oklch(50% 0.134 242.749); /* same blue: white text stays ≥ 4.5:1 */
|
|
--color-accent-hover: oklch(54% 0.15 242);
|
|
|
|
--color-slate-50: oklch(24.5% 0.042 262);
|
|
--color-slate-100: oklch(26.5% 0.042 261);
|
|
--color-slate-200: oklch(31% 0.042 259);
|
|
--color-slate-300: oklch(42% 0.043 257.3);
|
|
--color-slate-400: oklch(58% 0.045 257);
|
|
--color-slate-500: oklch(68% 0.04 256.8);
|
|
--color-slate-600: oklch(77% 0.03 255);
|
|
--color-slate-700: oklch(86.9% 0.022 252.894);
|
|
--color-slate-800: oklch(92.9% 0.013 255.508);
|
|
--color-slate-900: oklch(96.8% 0.007 247.896);
|
|
--color-slate-950: oklch(98.4% 0.003 247.858);
|
|
|
|
--color-red-50: color-mix(in oklab, oklch(63.7% 0.237 25.331) 14%, transparent);
|
|
--color-red-100: color-mix(in oklab, oklch(63.7% 0.237 25.331) 22%, transparent);
|
|
--color-red-200: color-mix(in oklab, oklch(63.7% 0.237 25.331) 35%, transparent);
|
|
--color-red-600: oklch(70.4% 0.191 22.216); /* error text: readable on dark cards */
|
|
--color-red-700: oklch(80.8% 0.114 19.571);
|
|
--color-red-800: oklch(88.5% 0.062 18.334);
|
|
--color-red-900: oklch(93.6% 0.032 17.717);
|
|
|
|
--color-amber-50: color-mix(in oklab, oklch(76.9% 0.188 70.08) 12%, transparent);
|
|
--color-amber-100: color-mix(in oklab, oklch(76.9% 0.188 70.08) 20%, transparent);
|
|
--color-amber-200: color-mix(in oklab, oklch(76.9% 0.188 70.08) 32%, transparent);
|
|
--color-amber-700: oklch(87.9% 0.169 91.605);
|
|
--color-amber-800: oklch(92.4% 0.12 95.746);
|
|
--color-amber-900: oklch(96.2% 0.059 95.617);
|
|
|
|
--color-emerald-50: color-mix(in oklab, oklch(69.6% 0.17 162.48) 13%, transparent);
|
|
--color-emerald-100: color-mix(in oklab, oklch(69.6% 0.17 162.48) 21%, transparent);
|
|
--color-emerald-200: color-mix(in oklab, oklch(69.6% 0.17 162.48) 33%, transparent);
|
|
--color-emerald-700: oklch(84.5% 0.143 164.978);
|
|
--color-emerald-800: oklch(90.5% 0.093 164.15);
|
|
--color-emerald-900: oklch(95% 0.052 163.051);
|
|
|
|
--color-sky-50: color-mix(in oklab, oklch(68.5% 0.169 237.323) 14%, transparent);
|
|
--color-sky-100: color-mix(in oklab, oklch(68.5% 0.169 237.323) 22%, transparent);
|
|
--color-sky-200: color-mix(in oklab, oklch(68.5% 0.169 237.323) 35%, transparent);
|
|
--color-sky-700: oklch(82.8% 0.111 230.318);
|
|
--color-sky-800: oklch(90.1% 0.058 230.902);
|
|
--color-sky-900: oklch(95.1% 0.026 236.824);
|
|
|
|
--color-blue-50: color-mix(in oklab, oklch(62.3% 0.214 259.815) 14%, transparent);
|
|
--color-blue-100: color-mix(in oklab, oklch(62.3% 0.214 259.815) 22%, transparent);
|
|
--color-blue-700: oklch(80.9% 0.105 251.813);
|
|
}
|
|
|
|
/* Rendered Markdown (notes). Colors use the palette, so dark mode follows. */
|
|
@layer components {
|
|
.markdown { overflow-wrap: anywhere; }
|
|
.markdown > * + * { margin-top: 0.5em; }
|
|
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { font-weight: 600; color: var(--color-slate-900); line-height: 1.3; }
|
|
.markdown h1 { font-size: 1.15rem; }
|
|
.markdown h2 { font-size: 1.05rem; }
|
|
.markdown h3, .markdown h4 { font-size: 1rem; }
|
|
.markdown a { color: var(--color-sky-700); text-decoration: underline; text-underline-offset: 2px; }
|
|
.markdown ul { list-style: disc; padding-left: 1.25rem; }
|
|
.markdown ol { list-style: decimal; padding-left: 1.25rem; }
|
|
.markdown li + li { margin-top: 0.15em; }
|
|
.markdown li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.25rem; }
|
|
.markdown input[type="checkbox"] { margin-right: 0.4em; vertical-align: -1px; }
|
|
.markdown blockquote { border-left: 3px solid var(--color-slate-300); padding-left: 0.75rem; color: var(--color-slate-600); }
|
|
.markdown code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--color-slate-100); border-radius: 0.25rem; padding: 0.1em 0.3em; }
|
|
.markdown pre { background: var(--color-slate-100); border-radius: 0.375rem; padding: 0.6rem 0.75rem; overflow-x: auto; }
|
|
.markdown pre code { background: none; padding: 0; }
|
|
.markdown hr { border-color: var(--color-slate-200); }
|
|
.markdown table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 0.85em; }
|
|
.markdown th, .markdown td { border: 1px solid var(--color-slate-200); padding: 0.25rem 0.5rem; text-align: left; }
|
|
.markdown th { background: var(--color-slate-50); font-weight: 600; }
|
|
.markdown.guide { line-height: 1.6; }
|
|
/* Keyboard users: a visible focus ring everywhere, and a way past the menus. */
|
|
:where(a, button, summary, select, [tabindex]:not([tabindex="-1"]), input[type=checkbox], input[type=radio]):focus-visible {
|
|
outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 0.25rem;
|
|
}
|
|
.skip-link { position: absolute; left: 0.5rem; top: -3rem; z-index: 50; background: var(--color-surface); color: var(--color-accent);
|
|
padding: 0.5rem 0.75rem; border-radius: 0.375rem; box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); }
|
|
.skip-link:focus { top: 0.5rem; }
|
|
.markdown.guide h1 { font-size: 1.5rem; font-weight: 700; }
|
|
.markdown.guide h2 { font-size: 1.15rem; margin-top: 1.25em; }
|
|
.markdown.guide h3 { margin-top: 1em; }
|
|
}
|
|
|
|
/* ---- Phones ---------------------------------------------------------- */
|
|
@layer base {
|
|
/* Grid columns may shrink below their content (a wide table scrolls inside
|
|
its card instead of widening the page). */
|
|
.grid > * { min-width: 0; }
|
|
}
|
|
|
|
/* Phones: each table row becomes a card; cells carry their column's name
|
|
(data-label, copied from the header by application.js). Tables that read
|
|
across columns (e.g. oil results by sample date) opt out with .table-keep. */
|
|
@media (max-width: 639px) {
|
|
.table:not(.table-keep) { display: block; min-width: 0; }
|
|
.table:not(.table-keep) thead { display: none; }
|
|
.table:not(.table-keep) tbody, .table:not(.table-keep) tfoot { display: block; }
|
|
.table:not(.table-keep) tr { display: block; padding: 0.625rem 1rem; border-bottom: 1px solid var(--color-slate-100); }
|
|
.table:not(.table-keep) td { display: block; padding: 0.125rem 0 !important; border: 0; text-align: left !important; white-space: normal !important; max-width: none !important; }
|
|
.table:not(.table-keep) td:empty { display: none; }
|
|
.table:not(.table-keep) td[data-label]:not([data-label=""])::before {
|
|
content: attr(data-label) " ";
|
|
margin-right: 0.35rem; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
|
|
color: var(--color-slate-500);
|
|
}
|
|
/* The first column names the row: show it as the card's title. */
|
|
.table:not(.table-keep) td:first-child { font-weight: 500; }
|
|
.table:not(.table-keep) td:first-child::before { content: none !important; }
|
|
/* Buttons-only cells (Edit / Resolve…) sit at the end of the card. */
|
|
.table:not(.table-keep) td[data-label=""]:not(:first-child) { padding-top: 0.375rem !important; }
|
|
.overflow-x-auto:has(> .table:not(.table-keep)) { overflow-x: visible; }
|
|
|
|
/* 16px text stops iOS zooming into fields on focus. */
|
|
.input, select.input, textarea.input { font-size: 16px; }
|
|
}
|
|
|
|
/* Touch screens: small buttons and tabs get a finger-sized target. */
|
|
@media (pointer: coarse) {
|
|
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; }
|
|
.btn-primary, .btn-secondary, .btn-danger { min-height: 2.5rem; }
|
|
}
|
|
|
|
/* A label and its value on one row (label column, then value), e.g. a flight's details. */
|
|
@utility detail-row {
|
|
@apply grid grid-cols-[6.5rem_minmax(0,1fr)] items-baseline gap-x-3;
|
|
& > dt { @apply text-slate-500; }
|
|
}
|
|
|
|
/* The top bar's connection status (connection_controller.js, after
|
|
SilverBullet): red when the server can't be reached, and a ring that fills
|
|
with the percentage in its hole while saving for offline or sending. Amber
|
|
and full while flights or squawks wait to send, with how many. */
|
|
header.is-offline { --color-header: var(--color-header-offline); }
|
|
.sync-ring {
|
|
position: relative;
|
|
display: inline-block;
|
|
flex: none;
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: 9999px;
|
|
background: conic-gradient(var(--ring-color, white) var(--progress, 0%), rgb(255 255 255 / 0.25) 0);
|
|
}
|
|
.sync-ring[hidden] { display: none; }
|
|
.sync-ring.is-waiting { --ring-color: oklch(87.9% 0.169 91.605); } /* amber-300 */
|
|
.sync-ring > span {
|
|
position: absolute;
|
|
inset: 2.5px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 9999px;
|
|
background-color: var(--color-header);
|
|
font-size: 9px;
|
|
font-variant-numeric: tabular-nums;
|
|
line-height: 1;
|
|
}
|