/*
 * OrderPad — panel skin.
 *
 * Filament is Tailwind, not Material, and pretending otherwise would mean
 * fighting it. What this does is borrow the four things that make the phone
 * apps look the way they do — a brand gradient on the chrome, a light grey
 * page with white panels on it, generous radii, and shadow instead of
 * hairline borders — so the panel and the handsets read as one product.
 *
 * Plain CSS in public/ rather than a Tailwind layer: this project has no
 * Node build, and adding one to restyle a panel is not a trade worth making.
 */

:root {
  --op-brand-a: #0b5ed7;
  --op-brand-b: #2b8cff;
  --op-radius: 18px;
  --op-radius-sm: 12px;
  --op-shadow: 0 4px 14px rgb(0 0 0 / 6%), 0 1px 3px rgb(0 0 0 / 3%);
  --op-shadow-lg: 0 8px 24px rgb(0 0 0 / 10%);
}

/* ---- the page ---------------------------------------------------------- */

html:not(.dark) body,
html:not(.dark) .fi-body,
html:not(.dark) .fi-main-ctn {
  background-color: #eff1f4;
}

/* ---- chrome: the one place the brand gradient lives -------------------- */

nav.fi-topbar {
  background-image: linear-gradient(90deg, var(--op-brand-a), var(--op-brand-b));
  border-bottom: 0;
  box-shadow: 0 2px 10px rgb(11 94 215 / 18%);
}

/* Everything sitting on the gradient has to be legible against it. */
nav.fi-topbar,
nav.fi-topbar a,
nav.fi-topbar .fi-icon-btn,
nav.fi-topbar .fi-icon-btn svg,
nav.fi-topbar .fi-logo,
nav.fi-topbar .fi-breadcrumbs a,
nav.fi-topbar .fi-breadcrumbs svg {
  color: #fff;
}

nav.fi-topbar .fi-icon-btn:hover {
  background-color: rgb(255 255 255 / 15%);
}

.fi-sidebar-header {
  background-image: linear-gradient(90deg, var(--op-brand-a), var(--op-brand-b));
  box-shadow: none;
}

.fi-sidebar-header .fi-logo {
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ---- sidebar ----------------------------------------------------------- */

html:not(.dark) .fi-sidebar,
html:not(.dark) .fi-sidebar-nav {
  background-color: #fff;
  border-right: 1px solid rgb(0 0 0 / 6%);
}

.fi-sidebar-item-btn {
  border-radius: var(--op-radius-sm);
  font-weight: 500;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-btn {
  background-color: rgb(24 119 242 / 12%);
  font-weight: 650;
}

.fi-sidebar-group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
}

/* ---- panels: shadow, not hairline -------------------------------------- */

html:not(.dark) .fi-section,
html:not(.dark) .fi-wi-stats-overview-stat,
html:not(.dark) .fi-ta-ctn,
html:not(.dark) .fi-fo-component-ctn > .fi-section,
html:not(.dark) .fi-modal-window {
  background-color: #fff;
  border: 0;
  border-radius: var(--op-radius);
  box-shadow: var(--op-shadow);
}

/* ---- the stat row: the first tile is the headline ---------------------- */

.fi-wi-stats-overview-stat {
  border-radius: var(--op-radius);
  padding: 1.15rem 1.25rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fi-wi-stats-overview-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--op-shadow-lg);
}

.fi-wi-stats-overview-stat-value {
  font-size: 1.9rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.fi-wi-stats-overview-stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* The money figure leads, the way it does on every screen in the apps.
 * Marked with a class from PHP: :first-child matched all four, because each
 * tile is the first child of its own grid cell. */
.fi-wi-stats-overview-stat.op-hero {
  background-image: linear-gradient(135deg, var(--op-brand-a), var(--op-brand-b));
  box-shadow: 0 8px 22px rgb(11 94 215 / 30%);
}

.fi-wi-stats-overview-stat.op-hero,
.fi-wi-stats-overview-stat.op-hero * {
  color: #fff !important;
}

.fi-wi-stats-overview-stat.op-hero .fi-wi-stats-overview-stat-label {
  opacity: 0.78;
}

/* ---- controls ---------------------------------------------------------- */

.fi-btn {
  border-radius: var(--op-radius-sm);
  font-weight: 600;
}

.fi-input-wrp,
.fi-select-input-wrp,
.fi-fo-field-wrp .fi-input-wrp {
  border-radius: var(--op-radius-sm);
}

html:not(.dark) .fi-input-wrp {
  background-color: #fff;
}

.fi-badge {
  border-radius: 999px;
  font-weight: 650;
}

/* ---- tables ------------------------------------------------------------ */

html:not(.dark) .fi-ta-header-cell {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background-color: #f7f8fa;
}

html:not(.dark) .fi-ta-row:hover {
  background-color: rgb(24 119 242 / 4%);
}

/* ---- dark mode: keep the shapes, drop the light-only colours ----------- */

.dark .fi-section,
.dark .fi-wi-stats-overview-stat,
.dark .fi-ta-ctn,
.dark .fi-modal-window {
  border-radius: var(--op-radius);
}

/* ---- tighten ------------------------------------------------------------
 * Filament is spaced for a desktop app you live in all day. This is a panel
 * an owner opens to answer one question, and the first screenful should hold
 * the answer rather than a third of it.
 */

.fi-main {
  padding-top: 1.25rem;
  padding-bottom: 1.5rem;
}

.fi-page-header {
  margin-bottom: 0.75rem;
}

/* The gap between widgets, and between the rows inside a widget grid.
 * The dashboard lays them out with fi-grid + fi-sc-has-gap, not fi-wi. */
.fi-main .fi-grid.fi-sc-has-gap {
  gap: 0.8rem;
}

.fi-wi-stats-overview-stat {
  padding: 0.9rem 1.05rem;
}

.fi-wi-stats-overview-stat-value {
  font-size: 1.65rem;
  line-height: 1.15;
}

.fi-wi-stats-overview-stat-description {
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.fi-section-content {
  padding: 1rem 1.15rem;
}

.fi-ta-header-cell,
.fi-ta-cell {
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

/* A table with four rows does not need a footer the height of a fifth. */
.fi-ta-content-ctn + .fi-ta-footer-ctn:empty,
.fi-ta-pagination:empty {
  display: none;
}

/* ---- icons: a colour per group -----------------------------------------
 * Twelve identical grey outlines is a list you read rather than scan. The
 * hue is per navigation group, so the colour means "which part of the panel
 * is this" rather than being decoration.
 *
 * Keyed on the link's href rather than the group's position. nth-of-type
 * counted the Dashboard <li> as a sibling of the groups, so every hue was
 * out by one — and position would have shifted again the next time a group
 * was added. An href names the thing it colours.
 */

.fi-sidebar-item-icon {
  border-radius: 9px;
  padding: 3px;
}

/* Menu      */
a[href$="/admin/menu-items"] .fi-sidebar-item-icon,
a[href$="/admin/categories"] .fi-sidebar-item-icon,
a[href$="/admin/tables"] .fi-sidebar-item-icon { color: #ea580c; background: rgb(234 88 12 / 12%); }

/* Inventory */
a[href$="/admin/ingredients"] .fi-sidebar-item-icon,
a[href$="/admin/stock-movements"] .fi-sidebar-item-icon { color: #0891b2; background: rgb(8 145 178 / 12%); }

/* Money */
a[href$="/admin/expenses"] .fi-sidebar-item-icon,
a[href$="/admin/salary-structures"] .fi-sidebar-item-icon,
a[href$="/admin/salary-payments"] .fi-sidebar-item-icon { color: #16a34a; background: rgb(22 163 74 / 12%); }

/* Reports */
a[href*="-report"] .fi-sidebar-item-icon { color: #7c3aed; background: rgb(124 58 237 / 12%); }

/* Platform */
a[href$="/admin/restaurants"] .fi-sidebar-item-icon,
a[href$="/admin/users"] .fi-sidebar-item-icon { color: #1877f2; background: rgb(24 119 242 / 12%); }

/* Logs */
a[href$="/admin/audit-logs"] .fi-sidebar-item-icon,
a[href$="/admin/item-availability-logs"] .fi-sidebar-item-icon { color: #64748b; background: rgb(100 116 139 / 12%); }

/* The one you are on keeps its hue but sits on the brand tint. */
.fi-sidebar-item.fi-active .fi-sidebar-item-icon {
  background: rgb(24 119 242 / 18%);
}

/* ---- tighter still ------------------------------------------------------
 * The first pass at this was too timid. On a 1400px window the dashboard was
 * still showing about half of what it holds.
 */

.fi-main {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.fi-header-heading {
  font-size: 1.5rem;
}

.fi-page-header,
.fi-header {
  margin-bottom: 0.6rem;
}

/* The widget's own frame — the "Today" card the stats sit inside. */
.fi-wi-stats-overview > .fi-section .fi-section-content,
.fi-wi-stats-overview .fi-section-content-ctn {
  padding: 0.85rem;
}

.fi-wi-stats-overview .fi-section-header {
  padding: 0.85rem 0.85rem 0;
}

.fi-wi-stats-overview-stat {
  padding: 0.8rem 0.95rem;
}

.fi-wi-stats-overview-stat-value {
  font-size: 1.5rem;
}

/* Table widgets: the heading and the rows both had room to spare. */
.fi-ta-header-ctn {
  padding: 0.8rem 1rem;
}

.fi-ta-header-heading {
  font-size: 1rem;
}

.fi-ta-cell .fi-ta-text {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.fi-ta-empty-state {
  padding: 1.5rem 1rem;
}

/* ---- stat tiles by kind -------------------------------------------------
 * Filament colours a stat's description and nothing else, so the tile itself
 * cannot be tinted from `->color()`. Each tile names its kind from PHP and
 * the skin gives it a soft wash and a coloured edge — the same language the
 * apps use, where colour marks state rather than decorating.
 */

.fi-wi-stats-overview-stat.op-stat {
  border-left: 4px solid transparent;
}

.op-stat-info  { background: #f2f7ff; border-left-color: #1877f2; }
.op-stat-good  { background: #f1faf4; border-left-color: #16a34a; }
.op-stat-calm  { background: #f6f7f9; border-left-color: #94a3b8; }
.op-stat-warn  { background: #fff8ec; border-left-color: #f59e0b; }
.op-stat-bad   { background: #fef3f2; border-left-color: #dc2626; }

.op-stat-info  .fi-wi-stats-overview-stat-value { color: #0b5ed7; }
.op-stat-good  .fi-wi-stats-overview-stat-value { color: #157f3c; }
.op-stat-warn  .fi-wi-stats-overview-stat-value { color: #b45309; }
.op-stat-bad   .fi-wi-stats-overview-stat-value { color: #b91c1c; }

/* ---- tables: let the numbers reach the edge ---------------------------- */

.fi-ta-header-cell:last-child,
.fi-ta-cell:last-child {
  padding-right: 1.25rem;
}

.fi-ta-record:hover {
  background-color: rgb(24 119 242 / 4%);
}

/* ---- reports ------------------------------------------------------------
 * The report pages were hand-rolled Tailwind with hard-coded greys, which is
 * why they were the one part of the panel that did not look like the rest —
 * they sat outside the design system rather than badly styled inside it.
 * These rules put them back in it.
 */

.op-report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.op-report-controls label {
  display: block;
}

.op-report-controls label > span {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

/* Pushes the CSV button to the far edge, away from the date fields it is
   not part of. */
.op-report-controls-spacer {
  flex: 1 1 auto;
}

/* ---- the figures ------------------------------------------------------- */

.op-report-summary {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.op-report-stat {
  padding: 0.9rem 1.05rem;
  background: #fff;
  border-left: 4px solid #cbd5e1;
  border-radius: var(--op-radius);
  box-shadow: var(--op-shadow);
}

.op-report-stat-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.op-report-stat-value {
  margin-top: 0.15rem;
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

/* The headline figure gets the same gradient the dashboard's does. */
.op-report-stat.op-hero {
  background-image: linear-gradient(135deg, var(--op-brand-a), var(--op-brand-b));
  border-left-color: transparent;
  box-shadow: 0 8px 22px rgb(11 94 215 / 30%);
}

.op-report-stat.op-hero .op-report-stat-label {
  color: rgb(255 255 255 / 78%);
}

.op-report-stat.op-hero .op-report-stat-value {
  color: #fff;
}

/* ---- the table --------------------------------------------------------- */

.op-report-table {
  overflow-x: auto;
  background: #fff;
  border-radius: var(--op-radius);
  box-shadow: var(--op-shadow);
}

.op-report-table table {
  width: 100%;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.op-report-table th {
  padding: 0.7rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
  color: #64748b;
  background: #f7f8fa;
  white-space: nowrap;
}

.op-report-table td {
  padding: 0.65rem 1rem;
  border-top: 1px solid #eef0f3;
}

.op-report-table tbody tr:hover {
  background: rgb(24 119 242 / 4%);
}

/* Money right, and lining figures so the columns read down. */
.op-report-table .op-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.op-report-table td.op-num {
  font-weight: 600;
}

.op-report-empty {
  padding: 2.5rem 1rem !important;
  text-align: center;
  color: #64748b;
}

.op-report-empty-icon {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.6rem;
  color: #cbd5e1;
}

.op-report-empty-hint {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  opacity: 0.75;
}

.dark .op-report-stat,
.dark .op-report-table {
  background: transparent;
}

/* ---- a single record, read as figures ----------------------------------
 * A one-row table makes the eye travel sideways to read one record. These
 * are the same numbers laid out to be read down.
 */

.op-report-figures {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  overflow: hidden;
  background: #eef0f3;
  border-radius: var(--op-radius);
  box-shadow: var(--op-shadow);
}

.op-report-figure {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.1rem;
  background: #fff;
}

.op-report-figure-label {
  font-size: 0.8rem;
  color: #64748b;
}

.op-report-figure-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dark .op-report-figures,
.dark .op-report-figure {
  background: transparent;
}
